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

piping issue #509

Closed
jimmywarting opened this issue Aug 25, 2016 · 4 comments
Closed

piping issue #509

jimmywarting opened this issue Aug 25, 2016 · 4 comments

Comments

@jimmywarting
Copy link

jimmywarting commented Aug 25, 2016

I have included the web streams polyfill into my project and I'm trying to pipe a readableStream to a writableStream

This is very simplified but it seems to work fine (it dose what i want it to do).
The writable stream gets all chunks it closes when the readableStream closes...

var rs = new ReadableStream({
    start(c) {
        c.enqueue(5);
        c.close();
    }
})

var ws = new WritableStream({})

rs.pipeTo(ws)

But as soon as i .close() the ReadableStream it logs 3 TypeError

Uncaught (in promise) TypeError: Reader was released and can no longer be used to monitor the stream's closedness(…)
Uncaught (in promise) TypeError: Writer was released and can no longer be used to monitor the stream's closedness(…)
Uncaught (in promise) TypeError: Writer was released and can no longer be used to monitor the stream's closedness(…)

I'm doing something wrong?

@domenic
Copy link
Member

domenic commented Aug 25, 2016

It's possible this is a bug in our implementation of pipeTo. We still are working to get that specced and implemented better. I'll try to fix that as we work on it.

@jimmywarting
Copy link
Author

Cool, thanks for letting me know. Hopefully I didn't do anything wrong and i just helped you find a bug :)

I know it's undergoing some changes ATM. But i like to prepare for what is coming 😉

@isonmad
Copy link
Contributor

isonmad commented Sep 17, 2016

I don't think this is pipeTo-specific. It's what always happens when the .closed promise is rejected, which happens when you do reader.releaseLock(). It happens twice for writer because it sets both .closed and .ready to rejected.

new ReadableStream().getReader().releaseLock();
new WritableStream().getWriter().releaseLock();

The promises would have to be lazily rejected in get closed() to avoid the warnings, wouldn't they?

isonmad pushed a commit to isonmad/streams that referenced this issue Sep 18, 2016
This silences uncaught promise errors as seen in issue whatwg#509.
@domenic
Copy link
Member

domenic commented Oct 28, 2016

Let's roll this into #547.

@domenic domenic closed this as completed Oct 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants