task: illumos/Solaris have thread-local weirdness #6777
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
In
tokio::task::local
, there's aLocalState::assert_called_from_owner_thread
function, which checksthat the caller's thread ID matches that of the thread on which the
LocalSet
was created. This assertion is disabled on FreeBSD andOpenBSD, with a comment indicating that this is because those systems
have "some weirdness around thread-local destruction". If memory serves,
I believe the "weirdness" was related to the order in which
thread-locals are destroyed relative to each other, or something along
those lines.
Upon running the tests on illumos, there appears to be a similar
panic in the
task_local_set_in_thread_local
due to this assertionassertion while dropping a
LocalSet
which lives in a thread-local.This leads me to believe that illumos, and presumably Solaris, also
exhibit the same "weirdness". This wouldn't be too surprising, given the
shared heritage of those systems.
Solution
This commit adds
target_os="illumos"
andtarget_os="solaris"
to thecfg
attribute that disables the assertion on systems determined tohave weirdness. This fixes the test panicking on illumos.
In the future, it might be worthwhile to look into changign the
assertion to only be disabled on weirdness-having systems while
dropping the
LocalSet
, rather than all the time. That way, we canstill check other accesses. But, I wanted to make the minimum change
necessary to fix it here before messing around with that.
This change was cherry-picked from PR #6769.