-
Notifications
You must be signed in to change notification settings - Fork 624
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
futures::sink::unfold easily causes panics if function returns errors #2600
Labels
A-sink
Area: futures::sink
Comments
erebe
added a commit
to erebe/futures-rs
that referenced
this issue
Jan 14, 2023
- fix issue rust-lang#2600. When an Unfold sink return an error it is left in an invalid state. Calling after that flush/close cause the sink to panic due to re-calling a future already completed. This patch aims to leave the sink in a valid state and allow calling flush/close without causing a panic.
taiki-e
pushed a commit
that referenced
this issue
Jan 15, 2023
- fix issue #2600. When an Unfold sink return an error it is left in an invalid state. Calling after that flush/close cause the sink to panic due to re-calling a future already completed. This patch aims to leave the sink in a valid state and allow calling flush/close without causing a panic.
Fixed in #2686 |
taiki-e
pushed a commit
that referenced
this issue
Jan 30, 2023
- fix issue #2600. When an Unfold sink return an error it is left in an invalid state. Calling after that flush/close cause the sink to panic due to re-calling a future already completed. This patch aims to leave the sink in a valid state and allow calling flush/close without causing a panic.
taiki-e
pushed a commit
that referenced
this issue
Jan 30, 2023
- fix issue #2600. When an Unfold sink return an error it is left in an invalid state. Calling after that flush/close cause the sink to panic due to re-calling a future already completed. This patch aims to leave the sink in a valid state and allow calling flush/close without causing a panic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found some strange behaviour and have minimised it to this:
Which crashes:
I think what is happening is that (from the outside) the
Sink
impl forUnfold
panics in some situations when it is called after returning an error. (TheSink
trait docs say "In most cases, if the sink encounters an error, the sink will permanently be unable to receive items" which I think suggests it might keep returningErr
, but doesn't seem to me to encompass panicking.)On the inside, evidently it is trying to reuse a returned future
R
, after it gotReady(Err)
, when it ought to callF
again to get a fresh future.The text was updated successfully, but these errors were encountered: