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

Avoid stream hanging on error #337

Merged
merged 1 commit into from
Oct 9, 2023
Merged

Avoid stream hanging on error #337

merged 1 commit into from
Oct 9, 2023

Conversation

richardgarnier
Copy link
Contributor

See the documentation on pipe: https://nodejs.org/api/stream.html#readablepipedestination-options

One important caveat is that if the Readable stream emits an error during processing, the Writable destination is not closed automatically. If an error occurs, it will be necessary to manually close each stream in order to prevent memory leaks.

On the current version this leads to responses hanging on both the server and the browser.
With this change, this leads to the browser seeing an error (with interrupted stream).

@icebob
Copy link
Member

icebob commented Oct 8, 2023

As I see the documentation, the pipeline added in Node 15 only, and moleculer-web current version supports from Node 10.

@richardgarnier
Copy link
Contributor Author

As I see the documentation, the pipeline added in Node 15 only, and moleculer-web current version supports from Node 10.

As far as I can see, pipeline was added in 10.0. Here is the latest documentation, and here the documentation for version 10.

@icebob
Copy link
Member

icebob commented Oct 9, 2023

Hmm, sorry, it looks like I checked the Streams promise API:
image

@icebob icebob merged commit c553ac5 into moleculerjs:master Oct 9, 2023
4 checks passed
@richardgarnier richardgarnier deleted the richard/fix-stream-hang branch October 10, 2023 03:34
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.

2 participants