Open Sija opened 5 years ago
still present? how to reproduce?
Can you check in gdb/lldb (add a breakpoint before the raise and then print the backtrack when execution stops) and report whether the line number is correct or zero?
First case means there is a bug in the dwarf decoder, zero means there is a bug in the debug information passed to llvm ir.
Is there a reproducible example?
I've reproduced it with kemal, perhaps there are other prerequisites.
It's quite easy to reproduce. I spot it from time to time but never gathered the courage to analyze it.
It might have sth to do with @[AlwaysInline]
annotation 🤔
I just ran into this (linux, OS X is OK) see top line of this backtrace:
https://github.com/crystal-lang/crystal/issues/7383#issuecomment-550862925
OK I was asked to add some other "classes" of wrong debug info to this issue, so I guess it'll be a grab bag of sorts...
Here's one:
Here's how to repro. Linux ubuntu. From a crystal git repo:
diff --git a/src/socket.cr b/src/socket.cr
index fb25d63ae..3da6719cf 100644
--- a/src/socket.cr
+++ b/src/socket.cr
@@ -544,6 +544,7 @@ class Socket < IO
end
private def unbuffered_write(slice : Bytes)
+ raise "hello"
evented_write(slice, "Error writing to socket") do |slice|
LibC.send(@fd, slice, slice.size, 0)
end
Use it somehow:
crystal$ ./bin/crystal spec/std/openssl/ssl/socket_spec.cr
Unhandled exception in spawn: hello (Exception)
from src/socket.cr:547:5 in 'unbuffered_write'
from src/io/buffered.cr:135:14 in 'write'
from src/openssl/bio.cr:31:7 in '->'
from src/slice/sort.cr:147:5 in 'heapify!'
from src/slice/sort.cr:153:10 in 'center_median!'
from src/slice/sort.cr:204:0 in 'cmp'
from src/slice/sort.cr:156:9 in 'center_median!'
from ???
from ???
from ???
from SSL_do_handshake
from src/openssl/ssl/socket.cr:32:15 in 'initialize'
from src/openssl/ssl/socket.cr:3:5 in 'new'
from spec/std/openssl/ssl/socket_spec.cr:43:7 in '->'
from src/fiber.cr:255:3 in 'run'
from src/fiber.cr:47:34 in '->'
from ???
Same trace, in gdb
$ gdb socket_spec
(gdb) b src/socket.cr:547
(gdb) r
(gdb) bt
#0 unbuffered_write () at /home/joshua/dev/crystal/src/socket.cr:547
#1 0x0000555555682c63 in write () at /home/joshua/dev/crystal/src/io/buffered.cr:135
#2 0x00005555555d5bb5 in -> () at /home/joshua/dev/crystal/src/openssl/bio.cr:31
#3 0x00007ffff7cfea33 in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.1
#4 0x00007ffff7cfeed3 in BIO_write () from /lib/x86_64-linux-gnu/libcrypto.so.1.1
#5 0x00007ffff7cfd02a in ?? () from /lib/x86_64-linux-gnu/libcrypto.so.1.1
#6 0x00007ffff7cff3a7 in BIO_ctrl () from /lib/x86_64-linux-gnu/libcrypto.so.1.1
#7 0x00007ffff7f6d3bd in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.1
#8 0x00007ffff7f71e0f in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.1
#9 0x00007ffff7f6c89a in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.1
#10 0x00007ffff7f589c4 in SSL_do_handshake () from /lib/x86_64-linux-gnu/libssl.so.1.1
#11 0x00005555556b0890 in initialize () at /home/joshua/dev/crystal/src/openssl/ssl/socket.cr:32
#12 0x00005555556b06c9 in new () at /home/joshua/dev/crystal/src/openssl/ssl/socket.cr:3
#13 0x00005555555d78ad in -> () at /home/joshua/dev/crystal/spec/std/openssl/ssl/socket_spec.cr:43
#14 0x0000555555614123 in run () at /home/joshua/dev/crystal/src/fiber.cr:255
#15 0x00005555555d2c96 in -> () at /home/joshua/dev/crystal/src/fiber.cr:47
#16 0x0000000000000000 in ?? ()
Appears crystal is identifying some lines as part of the crystal std lib crystal files (heapify et al lines) that are actually part of a 3rd party library.
Or maybe this example is unrelated since it doesn't have the 255's? hmm
Also somewhat related: #8352
Possibly related? the question marks in the backtrace here: https://github.com/crystal-lang/crystal/issues/8584
I'm hoping this was fixed in 2d02e52d9d7438bbcadcf222eed0fce2a7ca56d0
Sometimes I'm seeing stacktraces with frames having wrong line (and possible column) numbers. It seems to me there's some overflow going on (
0
/255
values).Example stacktrace - notice column numbers with
0
and255
:Tested with Crystal
0.27.2
and macOS10.13.6
.