-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Invalid memory access (signal 11) at address 0x48 #4916
Comments
We can't reproduce without some reduced code sample. The backtrace doesn't tell anything :( |
@ysbaddaden my code only contains looping and http client, I dont know which one is wrong, because when 4 days it's run without a problem :/
|
The best way to debug this is to disable crystals dig fault hander and turn on coredump collection. With that and the built executable we could debug this. Unfortunately turning off the sigfault handler requires editing the stdlib currently. |
@RX14 would be nice to have that auto disabled in debug mode or something , or at least --coredump (w.e makes sense) |
The sigfault handler is part of the stdlib so it should be a flag using |
For what it's worth, it looks like the sigfault handler can be disabled without editing the stdlib (please correct me if I'm wrong!). In the following example, I'm running a poorly-written program which uses some unsafe stuff incorrectly (hey, that backtrace looks very similar...) $ crystal run src/main.cr
Invalid memory access (signal 11) at address 0x48
[0x55751dc571e6] *CallStack::print_backtrace:Int32 +118
[0x55751dc4bc6d] __crystal_sigfault_handler +61
[0x7fc1c50d9da0] ???
[0x55751dc953c4] *TCPSocket+ +4
[0x55751dc3c473] ???
[0x55751dc4bb69] main +41
[0x7fc1c44b8f6a] __libc_start_main +234
[0x55751dc3bcaa] _start +42
[0x0] ??? I added the following lines to the top of my program: 👇 👇 👇 Signal::SEGV.reset
Signal::BUS.reset ☝️ ☝️ ☝️ This allowed it to receive the SEGV. $ crystal run src/main.cr
Program exited because of a segmentation fault (11) Now, I can run it through GDB to find the source of the issue: $ crystal build src/main.cr
$ gdb ./main
(gdb) run
Thread 1 "main" received signal SIGSEGV, Segmentation fault.
0x00005555555e53f4 in close () at /usr/lib/crystal/io/buffered.cr:194
194 flush if @out_count > 0
(gdb) where
#0 0x00005555555e53f4 in close () at /usr/lib/crystal/io/buffered.cr:194
#1 0x000055555558c49e in __crystal_main () at /tmp/cruddy-program/src/main.cr:19
#2 0x000055555559bb99 in main () at /usr/lib/crystal/main.cr:12 Even though it looks like there was an issue in the IO library, the real problem was that I used some uninitialized memory incorrectly. Attempting to access the garbage address of Hope this helps! 😄 |
gdb should break on signals before the crystal fault handler runs. I never had to disable the sigfault handler when using gdb, but it does prevent enabling coredumps outside gdb. Useful technique though. |
Hi, I found a similar issue I guess (Crystal 0.23.1 (2017-09-10) LLVM 5.0.0 on linux 64bits): Code: Build: Output: |
@Sija yes sorry. Didn't find that one. |
@Booss checkout |
Tried on master and got this: Using compiled compiler at `.build/crystal' |
@Booss what LLVM version? ( |
I'm using LLVM 5.0 Crystal 0.24.0+50 [c9fac56] (2017-11-13) LLVM: 5.0.0 |
Do you still get this? Does it give you a new trace with newer crystal? |
I dont know where it happened, but obviously my application has been running for 4 days +,
HTTP::Client, html parser, db connection (mongocr), etc
Spec
Log :
note : i dont know how to reproduce this bug.
The text was updated successfully, but these errors were encountered: