Skip to content

std: Fix a TLS destructor bug on OSX #26958

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

Merged
merged 1 commit into from
Jul 13, 2015

Conversation

alexcrichton
Copy link
Member

TLS tests have been deadlocking on the OSX bots for quite some time now and this
commit is the result of the investigation into what's going on. It turns out
that a value in TLS which is being destroyed (e.g. the destructor is run) can be
reset back to the initial state while the destructor is running if TLS is
re-accessed.

To fix this we stop calling drop_in_place on OSX and instead move the data to a
temporary location on the stack.

@rust-highfive
Copy link
Contributor

r? @huonw

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member Author

r? @brson

I'll be honest in saying that I don't think I fully grasp the ramifications of this behavior on OSX, and it may be the case the are more problems lurking. Regardless the checked in test fails reliably beforehand and passes afterwards on OSX, so I figure this can't hurt to at least move forward a bit!

@rust-highfive rust-highfive assigned brson and unassigned huonw Jul 11, 2015
@brson
Copy link
Contributor

brson commented Jul 12, 2015

@bors r+ This is some terrifying code.

@bors
Copy link
Collaborator

bors commented Jul 12, 2015

📌 Commit bd5a78d has been approved by brson

@bors
Copy link
Collaborator

bors commented Jul 12, 2015

⌛ Testing commit bd5a78d with merge 8edb9f1...

@bors
Copy link
Collaborator

bors commented Jul 12, 2015

💔 Test failed - auto-linux-64-nopt-t

TLS tests have been deadlocking on the OSX bots for quite some time now and this
commit is the result of the investigation into what's going on. It turns out
that a value in TLS which is being destroyed (e.g. the destructor is run) can be
reset back to the initial state **while the destructor is running** if TLS is
re-accessed.

To fix this we stop calling drop_in_place on OSX and instead move the data to a
temporary location on the stack.
@alexcrichton alexcrichton force-pushed the down-with-thread-dtors branch from bd5a78d to 987dc84 Compare July 12, 2015 22:09
@alexcrichton
Copy link
Member Author

@bors: r=brson 987dc84

@bors
Copy link
Collaborator

bors commented Jul 12, 2015

⌛ Testing commit 987dc84 with merge e1ac57d...

bors added a commit that referenced this pull request Jul 12, 2015
TLS tests have been deadlocking on the OSX bots for quite some time now and this
commit is the result of the investigation into what's going on. It turns out
that a value in TLS which is being destroyed (e.g. the destructor is run) can be
reset back to the initial state **while the destructor is running** if TLS is
re-accessed.

To fix this we stop calling drop_in_place on OSX and instead move the data to a
temporary location on the stack.
@bors bors merged commit 987dc84 into rust-lang:master Jul 13, 2015
@alexcrichton alexcrichton deleted the down-with-thread-dtors branch July 17, 2015 18:45
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.

5 participants