Skip to content

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.

@seanmonstar seanmonstar force-pushed the header-map-unsend-value-drain branch from 8ee74df to cfc1853 Compare November 26, 2019 00:03
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.

4 participants