ibdafna / webdash

WebAssembly powered Plotly Dash running in the browser
webdash-wine.vercel.app
BSD 3-Clause "New" or "Revised" License
147 stars 9 forks source link

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

Open ibdafna opened 3 years ago

ibdafna commented 3 years ago

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.

ivanov commented 3 years ago

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)
ibdafna commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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