tokio-rs / bytes

Utilities for working with bytes
MIT License
1.91k stars 288 forks source link

Core dump occurs sometimes when drop for bytes #575

Open tryor opened 2 years ago

tryor commented 2 years ago

When I use bytes, I sometimes get a coredump, but I don't know what the possible cause is.

Bytes version: 0.5.6

Where to use bytes in my project:

ALLOC: jemallocator = "0.3.2"

Rust toolchains: 1.64-x86_64-unknown-linux-gnu

The GDB trace is as follows:

Program terminated with signal SIGSEGV, Segmentation fault.
Dwarf Error: Cannot find DIE at 0x230 referenced from DIE at 0x171f07 [in module /root/myprogram]
#-1 0x00000000009e8503 in _$LT$bytes..bytes..Bytes$u20$as$u20$core..ops..drop..Drop$GT$::drop::h3588b858d9340711 (self=<optimized out>)
    at /cargo/registry/src/mirrors.tuna.tsinghua.edu.cn-df7c3c540f42cdbd/bytes-0.5.6/src/bytes.rs:492

(gdb) disassemble

   0x00000000009e84e7 <+87>:    mov    0x28(%r14),%rdi
   0x00000000009e84eb <+91>:    xor    %edx,%edx
   0x00000000009e84ed <+93>:    callq  *0x9b2945(%rip)        # 0x139ae38
   0x00000000009e84f3 <+99>:    mov    0x58(%r14),%rax
   0x00000000009e84f7 <+103>:   lea    0x50(%r14),%rdi
   0x00000000009e84fb <+107>:   mov    0x40(%r14),%rsi
   0x00000000009e84ff <+111>:   mov    0x48(%r14),%rdx
=> 0x00000000009e8503 <+115>:   callq  *0x8(%rax)
   0x00000000009e8506 <+118>:   mov    0x78(%r14),%rax
   0x00000000009e850a <+122>:   lea    0x70(%r14),%rdi
   0x00000000009e850e <+126>:   mov    0x60(%r14),%rsi
   0x00000000009e8512 <+130>:   mov    0x68(%r14),%rdx
   0x00000000009e8516 <+134>:   callq  *0x8(%rax)

https://github.com/tokio-rs/bytes/issues/564

Darksonn commented 2 years ago

It's hard to say what the issue is, but it seems like it only affects the old v0.5.x series considering that we now have two bug reports that use the older version.

tryor commented 2 years ago

In addition, musl is also used, target=x86_64-unknown-linux-musl. Hope that helps with the positioning problem