Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading renderer preloads #122894

Closed
rebornix opened this issue May 4, 2021 · 8 comments
Closed

Error loading renderer preloads #122894

rebornix opened this issue May 4, 2021 · 8 comments
Assignees
Labels
candidate Issue identified as probable candidate for fixing in the next release
Milestone

Comments

@rebornix
Copy link
Member

rebornix commented May 4, 2021

  • VS Code Version:
  • OS Version:

Steps to Reproduce:

  1. Create a renderer extension through yeoman generator, e.g.
"contributes": {
    "notebookOutputRenderer": [
      {
        "id": "better-jupyter-errors",
        "entrypoint": "./out/client/index.js",
        "displayName": "Better Jupyter Errors",
        "mimeTypes": [
          "application/x.notebook.error-traceback"
        ]
      }
    ]
  },
  1. Open a notebook which has errors (e.g., a Jupyter cell which has errors)
{
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "too many values to unpack (expected 2)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-8-b7fe370ef34b>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msegmentTime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"./2021/activity_6695646668.gpx\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0mdf\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0mname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0mtime\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Time'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m \u001b[0mellapsed_time\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Time'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0mdf\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Time'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m<ipython-input-7-f839f8fa0bb3>\u001b[0m in \u001b[0;36msegmentTime\u001b[0;34m(name)\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0msegmentTime\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m     \u001b[0mtrack\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdata2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mprocess_gpx_to_df\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      6\u001b[0m     \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'Longitude'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Latitude'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Altitude'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Time'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Speed'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Cadence'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      7\u001b[0m     \u001b[0mgpx_df2\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mDataFrame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata2\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcolumns\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mValueError\u001b[0m: too many values to unpack (expected 2)"
     ]
    }
   ],
   "source": [
    "data = segmentTime(\"./2021/activity_6695646668.gpx\")\n",
    "df = data[1]\n",
    "name = data[0]\n",
    "time = df['Time'].min()\n",
    "ellapsed_time = df['Time'].max() - df['Time'].min()\n",
    "cadence = data[1]['Cadence'].mean()\n",
    "max_cad = df['Cadence'].max()\n",
    "print(time.astimezone(pacific).strftime(\"%m/%d/%Y, %H:%M:%S %Z\"), name)\n",
    "print('time: ', ellapsed_time)\n",
    "print('cadence', cadence, 'max', max_cad)\n",
    "# ns = 1e-9 # number of seconds in a nanosecond\n",
    "# print(datetime.utcfromtimestamp(data[1][0:1].Time.astype(int) * ns))\n",
    "print(df.Speed.mean() * 60 * 60 / 1000)"
   ]
  }
  1. Open the notebook
Error loading preloads:
Unexpected 404 requesting file:///Users/penlv/code/personal/better-jupyter-errors/out/client/index.js: Not Found
@rebornix
Copy link
Member Author

rebornix commented May 4, 2021

Not sure what's the root cause but it seems we verified this work well 5 days ago? #119899 (comment) cc @roblourens

@connor4312
Copy link
Member

I made this change today but it works fine for me/in OSS 5148712

Does out/client/index.js actually exist?

@connor4312 connor4312 added the info-needed Issue requires more information from poster label May 4, 2021
@roblourens
Copy link
Member

If there's an issue, it could be related to my service worker changes last week? I can look at it tomorrow.

@rebornix
Copy link
Member Author

rebornix commented May 4, 2021

Does out/client/index.js actually exist?

yes, the same code works in VS Code stable, but didn't work locally in either Insiders or OSS. Also this is not kernel preloads, it's pure renderer.

Labelling it as candidate for now.

@rebornix rebornix added the candidate Issue identified as probable candidate for fixing in the next release label May 4, 2021
@rebornix rebornix added this to the April 2021 milestone May 4, 2021
@roblourens roblourens self-assigned this May 4, 2021
@roblourens
Copy link
Member

We don't include the renderer extension roots in the webview's localResourceRoots, and the renderer is not in rendererRootsCache. I can't figure out why it worked in stable, even with iframe webviews enabled, I think we probably just weren't checking the roots then, is that right @mjbvz?

We set localResourceRoots on the webview here which initially doesn't contain the renderer path

then when the output from the renderer is loaded, we try to update it here

but that doesn't do anything

@connor4312 connor4312 removed the info-needed Issue requires more information from poster label May 4, 2021
@mjbvz
Copy link
Collaborator

mjbvz commented May 4, 2021

I tested using a new renderer extension on insiders (85f8ebf) and couldn't reproduce on MacOS


Ah it happens for me when I manually package and install the vsix. Doesn't happen on a development extension build

@mjbvz
Copy link
Collaborator

mjbvz commented May 4, 2021

I confirmed that the requested resource is not listed in the localResourceRoots:

Screen Shot 2021-05-04 at 1 17 33 PM

No clue yet why this was working before but the no op line definitely explains it. I confirmed that the notebook passes in the correct list of localResourceRoots but never does anything with the value

mjbvz added a commit that referenced this issue May 4, 2021
For #122894

Not sure why this was a no-op but it seems to prevent the webview from correctly loading preloads
@mjbvz
Copy link
Collaborator

mjbvz commented May 4, 2021

I pushed a fix that implements the noop. This api only seems to be used from notebooks so I think it's a relatively safe fix

@rebornix Do you remember why the no op was originally added? Maybe we were trying to avoid reloading the backlayer webview?

mjbvz added a commit to mjbvz/vscode that referenced this issue May 4, 2021
For microsoft#122894

Not sure why this was a no-op but it seems to prevent the webview from correctly loading preloads
mjbvz added a commit that referenced this issue May 4, 2021
For #122894

Not sure why this was a no-op but it seems to prevent the webview from correctly loading preloads
@mjbvz mjbvz closed this as completed May 5, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
candidate Issue identified as probable candidate for fixing in the next release
Projects
None yet
Development

No branches or pull requests

4 participants