-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Rustc version 1.94.1 fails with error "fatal runtime error: out of TLS keys, aborting" #155758
Copy link
Copy link
Open
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.O-haikuTarget: Be extant; from mouldering old leaves; spring arrives againTarget: Be extant; from mouldering old leaves; spring arrives againT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.O-haikuTarget: Be extant; from mouldering old leaves; spring arrives againTarget: Be extant; from mouldering old leaves; spring arrives againT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.This issue may need triage. Remove it if it has been sufficiently triaged.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
After the Rust toolchain got updated from 1.89.0 to 1.94.1 on Haiku OS, I noticed that my project now fails to build with error:
out of TLS keys, aborting (screenshot)
I suppose here "TLS" refers to thread-local storage rather than transport layer security 🤔
So, it would seem that the new version of
rustcattempts to use more TLS slots (keys) than the operating system can provide.From what I understand, the maximum number of TLS (thread-local storage) keys is equal to
PTHREAD_KEYS_MAX, i.e., the "Maximum number of data keys that can be created by a process". It appears that this constant is platform-specific, but the POSIX standard defines the "Minimum Acceptable Value" as another constant called_POSIX_THREAD_KEYS_MAX– which is defined as 128.See here:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
So, this means that
rustcprobably should be very conservative with the number of TLS keys that it uses, because one must not assume that more than128TLS keys are available on any operating system. Nonetheless, it appears that Rust 1.94.1 violates the limit, whereas older Rust versions, such as 1.89.0, have been working flawlessly 😕To make it clear, the exactly same code used to compile just fine with Rust 1.89.0 on Haiku OS. Also, my code does not even use
thread_local!at all! So, I think, this must be a problem with the excessive use ofthread_local!inrustcitself, not in my own code. Furthermore, the problem only started after Haiku OS updated their Rust toolchain from 1.89.0 to 1.94.1, so the "problematic" change must be anywhere in between these versions. I cannot say which version exactly broke the build, sincerustupdoes not support Haiku OS yet, so I can only use the Rust version that Haiko OS itself provides (viapkgman).Best regards.
Might be related:
#147590