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

Connection errors should "end" readable streams #306

Closed
marshall007 opened this issue Oct 18, 2016 · 2 comments
Closed

Connection errors should "end" readable streams #306

marshall007 opened this issue Oct 18, 2016 · 2 comments

Comments

@marshall007
Copy link
Contributor

marshall007 commented Oct 18, 2016

Given that there is (at least currently) no way to recover when a connection is dropped on a cursor, I think we should close any readable streams bound to that cursor. For example:

const stream = r.table('test')
.toStream({ readable: true })
.pipe(/* transform */)
.pipe(/* writable */)

stream.on('error', ...) // errors on readable stream remain uncaught
stream.on('end', ...)

The way streams work in Node, an error event on the readable stream does not propagate through the other streams. You can work around this by attaching event listeners before you .pipe(), but since you can't recover from these errors anyway, I think we should also emit an end even, which definitely gets propagated.

@neumino
Copy link
Owner

neumino commented Nov 6, 2016

Sounds pretty reasonable for me. Fixed in 2.3.24.

@neumino neumino closed this as completed Nov 6, 2016
@marshall007
Copy link
Contributor Author

Thanks @neumino!

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

No branches or pull requests

2 participants