-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
segfault from wasm-bindgen CLI on OSX with recent rust nightlies #186
Comments
Update: I did a bisection search. Apparently
is good and
is bad. |
Oh dear this sounds bad! Are you able to attach a debugger and see where the fault is happening? This doesn't reproduce locally for me unfortunately :( |
Hmm, ok. The callstack apparently passes through thread_local via regex via docopt. It makes sense that docopt is involved since this is affecting every wasm-bindgen option. Here's my rust-lldb output (this is after re-installing wasm-bindgen-cli with the --debug option with nightly 2018-05-04):
If I'm reading that right, there's a panic from trying to lock a poisoned mutex, but then the panic code hits an EXC_BAD_ACCESS which is what actually crashes the app. Is that what you're seeing too? If so, it seems like there are two separate issues, the poisoned mutex and the EXC_BAD_ACCESS, no? And wasm-bindgen and wasm2es6js both call Docopt::new, so the reason this is only affecting wasm-bindgen is... some non-obvious difference in their usage strings?? There's more I'd like to debug on my end. But in the meantime, this all looks pretty far removed from wasm-bindgen. So I'd be fine closing this issue. Do you have any advice on where to file this instead? It's not clear to me if the fault lies in libstd, thread_local, regex, or some combo. Thanks for your help! |
cc @BurntSushi have you ever seen a segfault like this? I can't really explain what's going on :( @TimHambourger can you get a diassembly of precisely what the faulting instruction is? |
@alexcrichton Sure thing. Does this give you what you need?
FYI, I'll be traveling for the next few days and won't have the computer where I've been repro'ing this. |
Ok thanks! That's a little suspicious... If you get a chance can you see what the value of |
@alexcrichton Sadly, no, I haven't seen this particular blend before. I have seen segfaults with |
I've run this through a gauntlet of OSX releases on Travis and unfortunately none of them turned up segfaults :( @TimHambourger in all likelihood this is either a linker bug, a compiler bug, or a libc runtime bug. In that sense the "fix" here would be figuring out how to just flat out avoid whatever is triggering the bug. The wasm-bindgen crate doesn't otherwise use the regex crate so we could switch to something like clap perhaps, but I'm otherwise not entirely sure what to do about this :( |
@alexcrichton Thanks for the gauntlet of tests! I'm more than willing to believe that this is particular to this box. I tested on my newer mac w/ OSX 10.12 and saw no problems there. So I don't see any reason to refactor wasm-bindgen for this. I have a few workarounds available (including sticking to the newer box or installing with the version of rust that I know works). I'll go ahead and close this issue. But, if you're curious, I did check
|
Ok so the specific cause of this segfault is a misaligned value. The faulting instruction is The return value of the previous indirect call to the In that sense it looks like upgrading fixed the issue for you which is indeed expected! |
Ah, makes sense. That was very informative, thanks! Yes, I saw that one of your Travis CI tests hit the same OSX version as me but had a slightly newer XCode version (6.4 vs 6.2). So could be consistent with XCode being the culprit. |
This seems potentially related to a thread_local issue that we are seeing on older OSX versions with rust EDIT: Although it would seem that if there is nothing we can do about the older linker, possibly it would be better to chase a fix in the |
FWIW I'm seeing similar problems on OSX 10.9 w/ rust 1.27. |
@inferiorhumanorgans can you try reinstalling
and see if that fixes the issue for you? |
The wasm-bindgen command is reliably giving me a segfault on OSX 10.10.5 when I install with recent rust nightlies. I'm seeing an older rust version fix the issue, so I'm guessing this is a recent nightly regression. I figured I'd give my report in case it helps ID the issue.
The symptom:
Sample rustup show output:
I've tried different combos of wasm-bindgen-cli versions installed with various rust nightly versions. My observations are that
wasm-bindgen-cli 0.2.8 is bad when installed with nightly 2018-05-04, 2018-05-03, and 2018-04-30, but good with 2018-01-01.
wasm-bindgen-cli 0.2.4 through 0.2.8 are all bad with nightly 2018-05-03
Also note that wasm2es6js works for me as expected with all combos tested:
etc.
Thanks as always for the great work and let me know if I can provide more info.
The text was updated successfully, but these errors were encountered: