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

Remove Send from ValueDrain iterator #361

Closed
wants to merge 1 commit into from

Conversation

seanmonstar
Copy link
Member

As noted in #355, the ValueDrain iterator has un-synchronized mutation of the extra_values Vec, and using a Drain, a user can get multiple ValueDrains at the same time and use them in scoped threads.

This change removes the Send and Sync traits from ValueDrain. While technically a breaking change, it's expected to not affect anyone, and is the least-bad solution.

Copy link
Contributor

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

do you think this necessitates an 0.2 release, given

While technically a breaking change, it's expected to not affect anyone, and is the least-bad solution.

@seanmonstar
Copy link
Member Author

The point is to fix technically unsound behavior, without forcing user's to deal with all the other breaking changes.

@hawkw
Copy link
Contributor

hawkw commented Nov 26, 2019

yeah, i just wasn't sure if it was a concern that this is technically a semver violation. seems fine to me 👍

@carllerche
Copy link
Collaborator

What was the reason to opt for this instead of move values eagerly into the iterator?

@seanmonstar
Copy link
Member Author

Moving them eagerly adds a cost of allocation even if you're not going to use them, just to save a super obscure case.

@carllerche
Copy link
Collaborator

@seanmonstar it could be "optimized" to be a small vec, then the allocation is avoided in most cases.

@seanmonstar
Copy link
Member Author

Is all that fiddling worth not making this change? Do we expect even a single person to be sending ValueDrain to another thread?

@carllerche
Copy link
Collaborator

Making it !Send will break any usage w/ Tokio & calling .await while holding to the iterator.

@seanmonstar
Copy link
Member Author

Bleck, gross. I've open #362 with a different solution.

@seanmonstar seanmonstar deleted the header-map-unsend-value-drain branch November 26, 2019 01:37
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.

None yet

3 participants