Skip to content

Remove Send from ValueDrain iterator - #361

Closed
seanmonstar wants to merge 1 commit into
masterfrom
header-map-unsend-value-drain
Closed

Remove Send from ValueDrain iterator#361
seanmonstar wants to merge 1 commit into
masterfrom
header-map-unsend-value-drain

Conversation

@seanmonstar

Copy link
Copy Markdown
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

@hawkw hawkw left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member Author

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

@hawkw

hawkw commented Nov 26, 2019

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Collaborator

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

@seanmonstar

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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

@seanmonstar

Copy link
Copy Markdown
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
Copy Markdown
Collaborator

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

@seanmonstar

Copy link
Copy Markdown
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.

3 participants