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

Refreshing the page causes ERR_STREAM_WRITE_AFTER_END error #47

Closed
G-Rath opened this issue Dec 5, 2018 · 8 comments · Fixed by #93
Closed

Refreshing the page causes ERR_STREAM_WRITE_AFTER_END error #47

G-Rath opened this issue Dec 5, 2018 · 8 comments · Fixed by #93

Comments

@G-Rath
Copy link
Contributor

G-Rath commented Dec 5, 2018

When refreshing the page with hmr enabled (and connected via websocket to the serve server), an exception is logged to the webpack console.

This doesn't actually stop anything from working.

  • Webpack Version: v4.26.1
  • Operating System (or Browser): Windows 10, Chrome 71.0.3578.80
  • Node Version: v10.14.1
  • webpack-plugin-dev Version: v0.1.2

How Do We Reproduce?

https://github.com/G-Rath/js-bugs/tree/base/webpack-plugin-serve

Expected Behavior

No errors in webpack console when refreshing page.

Actual Behavior

Error is logged:

Error [ERR_STREAM_WRITE_AFTER_END]: write after end
      at writeAfterEnd (_stream_writable.js:243:12)
      at Socket.Writable.write (_stream_writable.js:291:5)
      at Sender.sendFrame (C:\Users\G-Rath\workspace\projects-personal\js-bugs\node_modules\ws\lib\sender.js:404:20)
      at Sender.doClose (C:\Users\G-Rath\workspace\projects-personal\js-bugs\node_modules\ws\lib\sender.js:141:10)
      at Sender.close (C:\Users\G-Rath\workspace\projects-personal\js-bugs\node_modules\ws\lib\sender.js:128:12)
      at WebSocket.close (C:\Users\G-Rath\workspace\projects-personal\js-bugs\node_modules\ws\lib\websocket.js:215:18)
      at Receiver.receiverOnConclude (C:\Users\G-Rath\workspace\projects-personal\js-bugs\node_modules\ws\lib\websocket.js:695:32)
      at Receiver.emit (events.js:182:13)
      at Receiver.controlMessage (C:\Users\G-Rath\workspace\projects-personal\js-bugs\node_modules\ws\lib\receiver.js:436:14)
      at Receiver.getData (C:\Users\G-Rath\workspace\projects-personal\js-bugs\node_modules\ws\lib\receiver.js:330:42)
@matheus1lva
Copy link
Collaborator

I tested locally, even forcing a refresh (ctrl + shift + R) and i did not get an error... i'll see if i can create a windows box to test those types of problems.

@shellscape
Copy link
Owner

@G-Rath I couldn't reproduce on my end, but that may very well be a windows-only issue.

Open up node_modules/webpack-plugin-serve/lib/routes.js and insert the following at line 83 (just before the for:

        socket.on('error', (...args) => {
          console.log('socket error', ...args)
        });

If that doesn't trap the error, try lib/ws.js and insert the following after line 15:

  socketServer.on('error', (...args) => {
    console.log('server error', ...args);
  });

Either of those might trap the error and prevent the output you're seeing.

(Of course, you can also use an inspector if you'd like to go that route.)

@shellscape
Copy link
Owner

@G-Rath I think we've narrowed this problem down to a regression in Node 10.14.x. Try downgrading to 10.13.x and I'd bet you no longer see this error (that was the behavior we observed). I've reported this to the Node folks in the mean time.

@shellscape
Copy link
Owner

Confirmed. The node maintainers have identified this as a regression that snuck in. The solution is to use 10.0.0 - 10.13.0 until that gets fixed. Given that this is confirmed an upstream problem that's affecting more than this module, I'm gonna close it.

Cheers for reporting this originally, you helped a great many people by pointing out the problem 🍻

@G-Rath
Copy link
Contributor Author

G-Rath commented Dec 12, 2018

@shellscape could you link to the relevant material on the node side of things, so we can watch the issue?

@shellscape
Copy link
Owner

Yeah for sure nodejs/node#24958

@lxe
Copy link
Contributor

lxe commented Jan 16, 2019

Is 10.15 compatible? This was fixed nodejs/node#24958 (comment)

@shellscape
Copy link
Owner

@lxe in theory it should be :) haven't tested it yet.

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

Successfully merging a pull request may close this issue.

4 participants