Webview plots sometimes hang while loading resources on Linux
This has caused a bunch of failures in our smoke tests for plots which use webviews with local resources (e.g. IPyWidgets).
From the logs, it looks like there's a ~31 second pause after loading the first webview preload script. In all other test cases there's almost no pause at all.
Also looks like it eventually does finish and then create the jupyter.widget.control comm, which means the test may pass eventually.
From a passing test:
2024-08-22 04:35:17.364 [debug] loadLocalResource - begin. requestUri=file:///home/runner/work/positron/positron/.build/builtInExtensions/ms-toolsai.jupyter-renderers/out/client_renderer/preload.js
2024-08-22 04:35:17.365 [debug] loadLocalResource - found resource to load. requestUri=file:///home/runner/work/positron/positron/.build/builtInExtensions/ms-toolsai.jupyter-renderers/out/client_renderer/preload.js, resourceToLoad=file:///home/runner/work/positron/positron/.build/builtInExtensions/ms-toolsai.jupyter-renderers/out/client_renderer/preload.js
2024-08-22 04:35:17.385 [debug] loadLocalResource - begin. requestUri=file:///home/runner/work/positron/positron/extensions/positron-ipywidgets/renderer/media/index.js
2024-08-22 04:35:17.386 [debug] loadLocalResource - found resource to load. requestUri=file:///home/runner/work/positron/positron/extensions/positron-ipywidgets/renderer/media/index.js, resourceToLoad=file:///home/runner/work/positron/positron/extensions/positron-ipywidgets/renderer/media/index.js
From a failed test:
2024-08-22 04:35:18.621 [debug] loadLocalResource - begin. requestUri=file:///home/runner/work/positron/positron/.build/builtInExtensions/ms-toolsai.jupyter-renderers/out/client_renderer/preload.js
2024-08-22 04:35:18.622 [debug] loadLocalResource - found resource to load. requestUri=file:///home/runner/work/positron/positron/.build/builtInExtensions/ms-toolsai.jupyter-renderers/out/client_renderer/preload.js, resourceToLoad=file:///home/runner/work/positron/positron/.build/builtInExtensions/ms-toolsai.jupyter-renderers/out/client_renderer/preload.js
2024-08-22 04:35:49.940 [debug] loadLocalResource - begin. requestUri=file:///home/runner/work/positron/positron/extensions/positron-ipywidgets/renderer/media/index.js
2024-08-22 04:35:49.941 [debug] loadLocalResource - found resource to load. requestUri=file:///home/runner/work/positron/positron/extensions/positron-ipywidgets/renderer/media/index.js, resourceToLoad=file:///home/runner/work/positron/positron/extensions/positron-ipywidgets/renderer/media/index.js
#4391 makes interactive plot webviews reuse the same service worker, and service workers are used to load resources into webviews (upstream PR: https://github.com/microsoft/vscode/pull/120654; they intercept the request, ask the main thread to read the file and return a stream response, which they then pass back to the webview). That PR is also around the time these tests started to fail, so it is quite possibly related.
I have not been able to repro this on macOS.