`thread_local!` initialization code panics on some `aarch64-apple-darwin` envs, works on others
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
https://github.com/near/near-sdk-rs/blob/master/near-sdk/src/environment/mock/mod.rs#L11-L16
thread_local! {
static BLOCKCHAIN_INTERFACE: RefCell<MockedBlockchain>
= RefCell::new(MockedBlockchain::default());
}
I expected to see this happen:
thread_local! initialization code for RefCell::new(MockedBlockchain::new)
works
Instead, this happened:
on unclarified aarch64-apple-darwin environment(s) thread_local!
panics on https://doc.rust-lang.org/src/core/ptr/mod.rs.html#1277 .
The issue doesn't reproduce on other aarch64-apple-darwin real macs,
and on macos-14-arm64 github actions vm.
Original issue: https://github.com/near/near-sdk-rs/issues/1252
Meta
rustc --version --verbose:
stable: 1.80, 1.81, 1.82 panics
beta 1.83 panics
nightly 1.84 panics
backtrace from original issue:
https://github.com/near/near-sdk-rs/issues/1252#issuecomment-2454692564
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the near-sdk-rs environment/mock/mod.rs snippet and reproduce the panic on an affected aarch64-apple-darwin environment, comparing it with a working real Mac or macos-14-arm64 GitHub Actions VM. Inspect the backtrace and the referenced core/ptr implementation, then use the original issue and its linked comment for context. Done means the platform-specific initialization failure is explained and a regression is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100