-
Notifications
You must be signed in to change notification settings - Fork 64
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
SIGBUS: Illegal storage access. (Attempt to read from nil?) on macOS #122
Comments
That's a shame. @genotrance any chance you could take a look? |
Happy to help debug if there is anything I can do |
Using Nim:
and Nimble:
If I run tests:
Not positive if this is helpful |
Seems like this is where the crash is coming from:
Can you look into that code and debug why that's nil? |
Sorry I've not had OSX access for some time, but feels like an SSL setup issue. Might be worth checking which version of openssl is present, updating with brew, and checking the order of versions in the Nim openssl wrapper. |
Hmm - it could be - here is my version:
At the end of httpclient.nim, I added:
with no error when I run it. When I check the the wrapper ( when defined(osx):
const versions = "(.1.1|.38|.39|.41|.43|.44|.45|.46|.10|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|)"
else:
const versions = "(.1.1|.1.0.2|.1.0.1|.1.0.0|.0.9.9|.0.9.8|.46|.45|.44|.43|.41|.39|.38|.10|)" When I build and test the wrapper:
Test:
which looks like it could be part of the issue. I'll try changing some openssl stuff and see whats going on... |
I don't think that's an issue, don't mess with |
I've since moved to using a different computer (also macOS) which does not have this problem. I'm going to chock it up to my weird setup on the old machine and close; someone else can re-open if this becomes an issue or something :) Thanks! |
can we reopen: ➜ bin curl https://nim-lang.org/choosenim/init.sh -sSf | sh OSX Catalina, AppleClang 11. |
@Milerius can you have a look at the above posts by me and the original author and see if you can reproduce by using |
I just tried on Mojave with openssl 1.1.1d and it all works fine. This is with Nim 1.0.4 and choosenim 0.5.0+. |
We need a debug build of choosenim so that we can ask users who receive such crashes to try it and give us a stack trace. |
|
Just this. |
Okay, I'll add it to the CI and debug builds will get posted for every release. |
PR #160 now posts debug builds. Next minor release will have debug builds which can be used for such issues going forward. |
EDIT: this is probably a red herring, caused by nim-lang/Nim#9634 EDITafter instrumenting the sh file to instead use debug build choosenim-0.5.1_macosx_amd64_debug I get:
which means error isn't caught here, which points to your code @genotrance :) proc extract*(path: string, extractDir: string) =
display("Extracting", path.extractFilename(), priority = HighPriority)
try:
nimarchive.extract(path, extractDir)
except Exception as exc:
raise newException(ChooseNimError, "Unable to extract. Error was '$1'." %
exc.msg) |
./choosenim-0.5.1_macosx_amd64_debug show [10:35:17] |
./choosenim-0.5.1_macosx_amd64_debug devel [10:33:20] |
Just tried to install via Curl curl https://nim-lang.org/choosenim/init.sh -sSf | sh Is there another way I can update nim to the latest without building ? Should I use brew ? |
On OSX, we do not ship official binaries yet, it has to be built even with choosenim. I'm not sure if Nim is in brew or what version it is at either, easiest is to build from source - shouldn't take too long. |
Ok thanks for the fast update |
Not sure if this is relevant or not but I have pasted below the build script using brew on Osx. brew info nim [12:03:12] brew install nim --HEAD ==> Cloning https://github.com/nim-lang/Nim.git nim -v [12:18:17] git hash: c8998c498f5e2a0874846eb31309e1d1630faca6 Edited the ruby file for brew -- NOTE you have to uninstall first |
So this is the line that is crashing: https://github.com/nim-lang/Nim/blob/devel/lib/pure/net.nim#L543 I wonder if some versions of macOS have an OpenSSL which disallows this. @nixfreak what's your macOS version? Can you try the following code and see whether it works for you? import httpclient
let client = newHttpClient()
echo(client.getContent("https://google.com") Make sure to compile with |
This comment has been minimized.
This comment has been minimized.
That's odd and suggests to me that there may be a bug in how choosenim was built. |
Yeah I still can't install via choosnim I had to build nim and now I have 1.1.1 installed. |
#139 is also similar. |
I did some additional testing and was able to reproduce this issue. My Now, brew has installed two additional versions of openssl in the cellar, I don't know why this version of openssl is not working with choosenim but hope someone has some ideas to proceed here. |
@genotrance did you see #122 (comment)
there could be more than 1 bug involved here, potentially. |
Yes but I focused first on the openssl variation since that's been reported more often. |
As suggested by @timotheecour in IRC, I recompiled If I switch to another window using the default libressl version or the openssl version of It appears our Nim openssl wrapper has some bug with the |
I spent a ton of time on openssl crap. My opinion openssl project breaks their API all the time but you are forced to use it, as it's practically part of the os. Just find nim-openssl pairing that works and stick with it. It's very fregile. It's easy to get openssl microversion that is not compatible or just plain buggy. |
This is a duplicate of nim-lang/Nim#9419 and can be tracked there. Just replace libpq with libcurl in this case. |
So the root cause is loading libcurl + openssl in the same program (where libcurl loads a different openssl version)? We should start a bug hall of fame just for this :) Thank you for testing this @genotrance, can you confirm by compiling choosenim without libcurl and see if that fixes the problem? (you can just comment this out to do that: https://github.com/dom96/choosenim/blob/master/src/choosenim.nims#L2). |
Just tried this test and it works fine without libcurl. Compile it back in and it crashes again. |
As mentioned in the Nim issue, we can fix this quite easily for choosenim. |
Nice job ya'll! Been following this just to see what happens after opening it half a year ago |
Issue is closed, but I'm still experiencing it on github actions: https://github.com/D-Nice/argon2_bind/runs/456797271?check_suite_focus=true
OT: but especially for CI/headless environments, shouldn't the analytics prompt be opt-out by default, or can a -n flag be passed. |
Issue has been fixed in #head but a new release hasn't been cut yet. We are close. |
on zsh/bash on macOS 10.14.2
The text was updated successfully, but these errors were encountered: