Skip to content
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

TLS code hits assertion failure (probably in libsyntax) #19280

Closed
nodakai opened this issue Nov 24, 2014 · 1 comment · Fixed by #19285
Closed

TLS code hits assertion failure (probably in libsyntax) #19280

nodakai opened this issue Nov 24, 2014 · 1 comment · Fixed by #19285
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@nodakai
Copy link
Contributor

nodakai commented Nov 24, 2014

$ cd openmod
$ mkdir foo
$ echo 'mod foo; fn main(){}' > a.rs
$ rustc a.rs
a.rs:1:5: 1:8 error: file not found for module `foo`
a.rs:1 mod foo; fn main(){}
           ^~~
a.rs:1:5: 1:8 help: name the file either foo.rs or foo/mod.rs inside the directory .
a.rs:1 mod foo; fn main(){}
           ^~~
panicked at 'assertion failed: `(left == right) && (right == left)` (left: `22`, right: `0`)', /home/nodakai/src/rust-HEAD/src/libstd/sys/unix/thread_local.rs:26
run with `RUST_BACKTRACE=1` to see a backtrace
$ rustc --version verbose
rustc 0.13.0-dev (bad1062ca 2014-11-24 09:56:34 +0000)
binary: rustc
commit-hash: bad1062caaaefe0963d7b8513786c8283e74f1e7
commit-date: 2014-11-24 09:56:34 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-dev

22 is EINVAL returned by pthread_setspecific(3).

When I set RUST_BACKTRACE=1, the probability of panicking drops to 1/100. I was lucky enough to get this transcript by running rustc in shell loop while sleep 0.1; do rustc ... done, but it wasn't informative after all:

modopen.rs:1:5: 1:9 error: file not found for module `cell`
modopen.rs:1 mod cell;
                 ^~~~
modopen.rs:1:5: 1:9 help: name the file either cell.rs or cell/mod.rs inside the directory .
modopen.rs:1 mod cell;
                 ^~~~
panicked at 'assertion failed: `(left == right) && (right == left)` (left: `22`, right: `0`)', /home/nodakai/src/rust-HEAD/src/libstd/sys/unix/thread_local.rs:26
stack backtrace:
   1:     0x7f5eabf67020 - rt::backtrace::imp::write::hc875af40f612e37aLBt

I haven't hit this problem with the current snapshot rustc c9f6d69 2014-11-21 03:41:45 +0000

@huonw huonw added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Nov 24, 2014
@nodakai nodakai changed the title TLS code hits assertion failure in (probably in libsyntax) TLS code hits assertion failure (probably in libsyntax) Nov 24, 2014
alexcrichton added a commit to alexcrichton/rust that referenced this issue Nov 24, 2014
It turns out that rustrt::at_exit() doesn't actually occur after all pthread
threads have exited (nor does atexit()), so there's not actually a known point
at which we can deallocate these keys. It's not super critical that we do so,
however, because we're about to exit anyway!

Closes rust-lang#19280
@alexcrichton
Copy link
Member

Fixed in #19285, thanks for the report @nodakai!

bors added a commit that referenced this issue Nov 25, 2014
It turns out that rustrt::at_exit() doesn't actually occur after all pthread
threads have exited (nor does atexit()), so there's not actually a known point
at which we can deallocate these keys. It's not super critical that we do so,
however, because we're about to exit anyway!

Closes #19280
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants