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

HMR Infinite request loop after restarting webpack serve #13857

Closed
stefan-toubia opened this issue Jul 23, 2021 · 3 comments
Closed

HMR Infinite request loop after restarting webpack serve #13857

stefan-toubia opened this issue Jul 23, 2021 · 3 comments

Comments

@stefan-toubia
Copy link

stefan-toubia commented Jul 23, 2021

Bug report

What is the current behavior?
I've been working on a webpack 5 migration and have run into a bug where HMR gets stuck in an infinite loop after restarting the dev server. Sorry I'm not sure if this is an issue specific to webpack dev server or not, it seems to be originating from this repo.

If the current behavior is a bug, please provide the steps to reproduce.

  1. Start webpack dev server webpack serve
  2. Modify a source file.
    Now you observe the first hot-update.json request like http://localhost/static/customer-dashboard.263d2b2c0d78de6116e2.hot-update.js
  3. Stop WDS.
    Console:
[WDS] Disconnected!
GET http://localhost:9111/sockjs-node/info?t=1627083911242 net::ERR_CONNECTION_REFUSED
  1. Start WDS.
    Crash loop starts: GET http://localhost/static/customer-dashboard.c3beb7f29395129d613f.hot-update.json 404 (Not Found)

I have to manually refresh the page to resolve it, but the browser is freezing up at this point from the thousands of requests.

Call stack
(anonymous) (jsonp chunk loading:538)
Promise.then (async)
__webpack_require__.hmrM (jsonp chunk loading:537)
Promise.then (async)
hotCheck (hot module replacement:234)
check (dev-server.js:15)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)
Promise.then (async)
check (dev-server.js:16)
(anonymous) (dev-server.js:29)

The jsonp chunk loading error:
TypeError: Cannot read property 'requestContent' of undefined

We write the output to disk using devServer.writeToDisk and serve it from a separate server but I've also tested it without writing to disk and making requests direct to WDS, same results. That means I also have output.clean = true, but I get the same results when disabling this.

I'm using persisted cache but get the same results when disabling the cache.

EDIT: Confirmed not broken in 5.45.1. I'm guessing it was introduced in #13576, what do you think @rockwalrus ? What I was seeing was that updateModules was [] and maybe should have been undefined since the window was never reloading.

.then(function (updatedModules) {
if (!updatedModules) {

What is the expected behavior?

Other relevant information:
webpack version: 5.46.0
Node.js version: tested on node 10 and 14
Operating System: macos 10.14.6
Additional tools:
Chrome
webpack-dev-server 3.11.2

@alexander-akait
Copy link
Member

Can you provide repo?

@stefan-toubia
Copy link
Author

@alexander-akait here you go https://github.com/stefan-toubia/webpack-5-hmr-bug

I was able to repro the issue on this repo.

@alexander-akait
Copy link
Member

Fixed #13877

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants