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

fix(browser): prevent error stream.push() after EOF #1932

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sanduluca
Copy link
Contributor

check if the stream is still open and writable before pushing data.

Also I was wondering if a Event Listener Cleanup should be made ? I dont see any removeEventListener to prevent any further callbacks from firing after closure:

    socket.removeEventListener('close', onClose);
    socket.removeEventListener('error', onError);
    socket.removeEventListener('message', onMessage);
    socket.removeEventListener('open', onOpen);

Fixes #1914

check if the stream is still open and writable before pushing data
@sanduluca
Copy link
Contributor Author

Hmm 🤔
nodejs/node#445

@robertsLando
Copy link
Member

@sanduluca Thanks for your PR!

About the event listeners, if you are speaking about Websocket event listeners yes it could make sense to remove them on destroy anyway once the socket is destroyed it should be garbage collected and should not create any problem but 🤷🏼‍♂️

@robertsLando
Copy link
Member

Hmm 🤔 nodejs/node#445

It's almost 10 years old now 😆 Anyway I wonder so if there is a better way to handle this? Does this change solve your issue?

@robertsLando
Copy link
Member

cc @mcollina could you give a look at this please?

@robertsLando
Copy link
Member

@mcollina ping

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

Successfully merging this pull request may close these issues.

[Bug]: JavascriptException: Error: stream.push() after EOF, js engine: hermes
2 participants