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

#2600 fix panic when Unfold sink return an error #2686

Merged
merged 1 commit into from Jan 15, 2023

Conversation

erebe
Copy link
Contributor

@erebe erebe commented Jan 14, 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 issue is really painful when using stream.forward(sink), as one may not know in case of an error if it is the stream or the sink that emitted this error.

This patch aims to leave the sink in a valid state and allow calling flush/close without causing a panic if it is returning an error

  - 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.
@erebe erebe requested a review from taiki-e as a code owner January 14, 2023 18:05
Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@taiki-e taiki-e merged commit c420551 into rust-lang:master Jan 15, 2023
@taiki-e taiki-e added A-sink Area: futures::sink 0.3-backport: pending The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet. labels Jan 15, 2023
taiki-e pushed a commit that referenced this pull request 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 taiki-e added 0.3-backport: completed and removed 0.3-backport: pending The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet. labels Jan 30, 2023
taiki-e pushed a commit that referenced this pull request 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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants