webdash icon indicating copy to clipboard operation
webdash copied to clipboard

Intermittent network errors on Chrome when running WebDash on 3rd party hosting websites

Open ibdafna opened this issue 4 years ago • 4 comments

Chrome seems to trigger NetworkError exceptions when loading Pyodide from free 3rd party hosting solutions such as Vercel and Netlify. This issue does not occur when served from a local HTTP server or when using Firefox (locally or on the free hosting services). This leads me to think Chrome has some sort of concurrent loading network mechanism which potentially hammers the free hosting services, who in turn ignore or drop the request, resulting in no response.

It's still a very shaky hypothesis at this stage, but this issue definitely needs investigating.

ibdafna avatar May 20 '21 22:05 ibdafna

for me, it's reliably the three largest packages that fail - numpy, pandas, and plotly.

pyodide.js:198 Couldn't load package from URL https://webdash.netlify.app:/python-dateutil.js
webdash.ts:216 Uncaught (in promise) ErrorEvent {isTrusted: true, message: "Uncaught Error: NetworkError for: https://webdash.netlify.app:/numpy.data", filename: "https://webdash.netlify.app/numpy.js", lineno: 1, colno: 2152, …}
numpy.js:1 Uncaught Error: NetworkError for: https://webdash.netlify.app:/numpy.data
pandas.js:1 Uncaught Error: NetworkError for: https://webdash.netlify.app:/pandas.data
plotly.js:1 Uncaught Error: NetworkError for: https://webdash.netlify.app:/plotly.data
    at XMLHttpRequest.xhr.onerror (plotly.js:1)

ivanov avatar May 20 '21 22:05 ivanov

Vercel have finally gotten back to me - there is some black magic sorcery in their edge network which identifies the excessive requests as a DDoS attack. There is no good way around that problem without a paid CDN. Potentially Fastly or equivalent. I am wondering is Service Workers can somehow pace the downloads and cache - might slower on the first run but fast afterwards.

ibdafna avatar Jul 29 '21 23:07 ibdafna

I investigated this further, and the issue stems from throttling free providers such as Vercel and Netlify apply to free account tiers. The solution would be to serve WebDash from a CDN which is designed for that kind of traffic.

ibdafna avatar Aug 25 '21 01:08 ibdafna

Issue seems to be resolved with #18. @ivanov are you able to confirm if the numpy/pandas issues are gone? 😄

ibdafna avatar Oct 16 '21 07:10 ibdafna