Zulip Chat Archive
Stream: lean4
Topic: Lean error codes (e.g. code 139)
Andrés Goens (Apr 29 2024 at 14:46):
Is there any reference to read what error codes mean? I'm getting a crash with just some error code (139) and it doesn't really tell me much more of what's going on:
error: external command `/home/goens/.elan/toolchains/leanprover--lean4---v4.7.0/bin/lean` exited with code 139
Rather than asking what 139 is specifically, I thought it might be worth asking how I can figure these things out on my own (didn't seem to find a thread asking about them in general)
Kevin Buzzard (Apr 29 2024 at 15:11):
Here's yesterday's "what does error code 139 mean?" question: https://leanprover.zulipchat.com/#narrow/stream/428973-nightly-testing/topic/Mathlib.20status.20updates/near/435877290
Andrés Goens (Apr 29 2024 at 15:12):
Kevin Buzzard said:
Here's yesterday's "what does error code 139 mean?" question: https://leanprover.zulipchat.com/#narrow/stream/428973-nightly-testing/topic/Mathlib.20status.20updates/near/435877290
seems to also be unanswered
Matthew Ballard (Apr 29 2024 at 15:15):
GPT says segfault (but perhaps that is already know to everyone here. New to me)
Michael Stoll (Apr 29 2024 at 15:33):
Maybe related to this...
Andrés Goens (Apr 29 2024 at 15:35):
FWIW my error was on a file that was not importing Mathlib (I've fixed it now, it was because I was using builtin_initalize
and not initalize
), but I guess I want to know how to deal with these error codes in general in the future :)
Richard Copley (Apr 29 2024 at 15:40):
I imagine it's 11 (SIGSEGV) with bit 7 set by something else to indicate that it's a signal rather than an error code.
Richard Copley (Apr 29 2024 at 15:46):
Probably by this.
Julian Berman (Apr 29 2024 at 15:54):
For most programs/languages it's usually but not always that yeah (a seg fault, and the error code is 128 + the real error code, with 11 being SIGSEGV).
@Andrés Goens is your error reproducible? If so you can try enabling crash reports and then that may contain something helpful to someone on the dev team.
Julian Berman (Apr 29 2024 at 15:55):
It depends a bit on your Linux distribution where/how to do that, but ulimit -S -c unlimited
is usually involved to actually make them be written out, and then we can go find where they end up on your machine.
Richard Copley (Apr 29 2024 at 15:57):
@Mac Malone, would it be useful to change the message from Lake?
diff
Richard Copley (Apr 29 2024 at 16:03):
I suppose not. It assumes the child is Lean, Bash, Perl or something that uses the same convention.
Julian Berman (Apr 29 2024 at 16:03):
I suspect that also will get wrong if someone actually intentionally exits with an exit code > 128 for whatever reason.
Andrés Goens (Apr 29 2024 at 16:07):
Julian Berman said:
For most programs/languages it's usually but not always that yeah (a seg fault, and the error code is 128 + the real error code, with 11 being SIGSEGV).
Andrés Goens is your error reproducible? If so you can try enabling crash reports and then that may contain something helpful to someone on the dev team.
@Julian Berman yep it's reproducible! Happy to do that, how do I enable crash reports?
Julian Berman (Apr 29 2024 at 16:09):
That's that ulimit -c unlimited
line I shared -- and then I forget if systemd is responsible for where those go at this point or not -- but share what distro you're on and we can look.
Julian Berman (Apr 29 2024 at 16:10):
Er, to be more explicit -- run that ulimit
line, and then make sure you run lean
and/or lake
in the same exact shell as you ran that in.
Andrés Goens (Apr 29 2024 at 16:13):
Hm, I guess it's not a stack overflow? it returns the same error and doesn't dump a core nor anything
Andrés Goens (Apr 29 2024 at 16:13):
(I'm on nixos)
Richard Copley (Apr 29 2024 at 16:13):
Perhaps a null (or otherwise bad) pointer dereference, then.
Richard Copley (Apr 29 2024 at 16:14):
Or (more likely?) an out-of-bounds array index
Andrés Goens (Apr 29 2024 at 16:17):
FWIW, valgrind doesn't seem to find anything strange either
Richard Copley (Apr 29 2024 at 16:18):
I'd suggest doing lake --verbose
to find the command line of the process that crashed, then running that command in your debugger to get a backtrace.
Andrés Goens (Apr 29 2024 at 16:30):
oh interesting, apparently it was segfaulting, but the indirection through lake was suppressing the segfault message :/ I did get a backtrace now:
backtrace
Kevin Buzzard (Apr 29 2024 at 18:24):
Thanks for taking the time!
Kevin Buzzard (Apr 29 2024 at 18:25):
BTW is it related to this ?
Kyle Miller (Apr 29 2024 at 18:34):
Lean core developers are looking into that issue. There's a chance it will be fixed by lean4#4028
Amos Turchet (Apr 29 2024 at 20:27):
Got same problem by just doing lake exe cache get
Kim Morrison (Apr 29 2024 at 23:39):
Unfortunately lean4#4028 hasn't fixed the earlier issue. We're still looking.
Last updated: May 02 2025 at 03:31 UTC