-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
check if the stream is still open and writable before pushing data
Hmm 🤔 |
@sanduluca Thanks for your PR! About the event listeners, if you are speaking about |
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? |
cc @mcollina could you give a look at this please? |
@mcollina ping |
@sanduluca could you explain why did you stick to FYI @robertsLando |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1932 +/- ##
==========================================
- Coverage 81.21% 81.15% -0.06%
==========================================
Files 24 24
Lines 1469 1470 +1
Branches 349 349
==========================================
Hits 1193 1193
- Misses 192 193 +1
Partials 84 84
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Yes the push is an operation on readable side but I think checking for readable or writeable here could be the same, I agree it would be better to change the check and use readableState instead |
@robertsLando I made some experiments that show that we better use
|
@KirillRodichevUtorg Could you create a new PR with your fixed version of this PR? Seems @sanduluca is not available so that would be faster |
…oxy streams Updated conditions in `BufferedDuplex` and `browserStreamBuilder` to check `proxy.readable` instead of `proxy._writableState.ended` to correctly handle the readable side of the stream. This ensures proper validation for `proxy.push()` operations, as they interact with the readable side. Thank you to the @KirillRodichevUtorg for pointing out this improvement.
I dont remeber why I did what I did, but thanks for pointing this out! Thanks for your experiments. It shows that the proxy is not destroyed but already not readable. I made the changes to the PR, just in case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No clue why electron tests are failing but I'm quite sure that's not related to this PR. LGTM
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:
Fixes #1914