Bug #13524
closed
miniruby: [BUG] Segmentation fault at 0x0055e487e00230 ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-li
Added by rtacconi (Riccardo Tacconi) over 7 years ago.
Updated about 6 years ago.
Description
Linux: Alpine Linux 3.5
./miniruby: [BUG] Segmentation fault at 0x0055e487e00230
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0003 E:001c20 (none) [FINISH]
-- Machine register context ------------------------------------------------
RIP: 0x00007f3c79126046 RBP: 0x000055e487e44d00 RSP: 0x00007ffd62f251e0
RAX: 0x00007f3c79608ae0 RBX: 0x000055e487e00000 RCX: 0x0000000000000000
RDX: 0x0000000000000001 RDI: 0x000055e487e44d00 RSI: 0x0000000000000037
R8: 0x00007f3c7916d680 R9: 0x0000000000000001 R10: 0x0000000000802005
R11: 0x000000000000007a R12: 0x00007f3c78c0d000 R13: 0x00007f3c79608ae0
R14: 0x00007f3c7937c090 R15: 0x00007f3c7937c0a0 EFL: 0x0000000000010212
-- Other runtime information -----------------------------------------------
55e487930000-55e487c31000 r-xp 00000000 00:2e 18687 /root/ruby-2.4.1/miniruby
55e487e30000-55e487e36000 r--p 00300000 00:2e 18687 /root/ruby-2.4.1/miniruby
55e487e36000-55e487e37000 rw-p 00306000 00:2e 18687 /root/ruby-2.4.1/miniruby
55e487e37000-55e487e45000 rw-p 00000000 00:00 0
7f3c78a00000-7f3c79000000 rw-p 00000000 00:00 0
7f3c7911c000-7f3c79378000 r-xp 00000000 00:2e 12926 /usr/local/lib/libjemalloc.so.2
7f3c79378000-7f3c7937b000 r--p 0005c000 00:2e 12926 /usr/local/lib/libjemalloc.so.2
7f3c7937b000-7f3c7937c000 rw-p 0005f000 00:2e 12926 /usr/local/lib/libjemalloc.so.2
7f3c7937c000-7f3c7937d000 rw-p 00000000 00:00 0
7f3c7937d000-7f3c79405000 r-xp 00000000 00:2e 24 /lib/ld-musl-x86_64.so.1
7f3c795ff000-7f3c79600000 ---p 00000000 00:00 0
7f3c79600000-7f3c79605000 rw-p 00000000 00:00 0
7f3c79605000-7f3c79606000 r--p 00088000 00:2e 24 /lib/ld-musl-x86_64.so.1
7f3c79606000-7f3c79607000 rw-p 00089000 00:2e 24 /lib/ld-musl-x86_64.so.1
7f3c79607000-7f3c7960a000 rw-p 00000000 00:00 0
7ffd62f07000-7ffd62f28000 rw-p 00000000 00:00 0 [stack]
7ffd62f2f000-7ffd62f31000 r--p 00000000 00:00 0 [vvar]
7ffd62f31000-7ffd62f33000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
make: *** [uncommon.mk:854: encdb.h] Aborted
- Status changed from Open to Feedback
Is it possible for you to show us how to reproduce this?
shyouhei (Shyouhei Urabe) wrote:
Is it possible for you to show us how to reproduce this?
Please, build it with this [[https://github.com/docker-library/ruby/blob/master/2.4/alpine/Dockerfile]]
shyouhei (Shyouhei Urabe) wrote:
Is it possible for you to show us how to reproduce this?
Hi, any update?
I think this is due to mixture of glibc and jemalloc.
Here is a gdb output.
Thread 1 "miniruby" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b03ca6 in je_arena_mapbitsp_read (mapbitsp=<optimized out>) at include/jemalloc/internal/arena.h:802
802 include/jemalloc/internal/arena.h: No such file or directory.
(gdb) bt
#0 0x00007ffff7b03ca6 in je_arena_mapbitsp_read (mapbitsp=<optimized out>) at include/jemalloc/internal/arena.h:802
#1 je_arena_mapbits_get (pageind=77, chunk=0x555555a00000) at include/jemalloc/internal/arena.h:809
#2 je_arena_mapbits_binind_get (pageind=77, chunk=0x555555a00000) at include/jemalloc/internal/arena.h:866
#3 je_arena_salloc (demote=false, ptr=0x555555a4dd00, tsdn=<optimized out>) at include/jemalloc/internal/arena.h:1387
#4 je_isalloc (demote=false, ptr=0x555555a4dd00, tsdn=<optimized out>)
at include/jemalloc/internal/jemalloc_internal.h:1054
#5 ifree (tsd=<optimized out>, slow_path=false, tcache=0x7ffff760d000, ptr=0x555555a4dd00) at src/jemalloc.c:1891
#6 free (ptr=0x555555a4dd00) at src/jemalloc.c:2016
#7 0x000055555573426a in ruby_getcwd () at util.c:531
(snip)
util.c:531 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v2_4_1/util.c?view=markup#l531
is call free(cwd) of jemalloc.
But cwd is a return value of getcwd(3) of glibc.
- Status changed from Feedback to Third Party's Issue
Took me time for several reasons:
- Had temporarily ran out of my docker hosts and had to prepare new one. This is my fault.
- The ruby:2.4-alpine's Dockerfile you linked kindly deletes compiler and other toolchains from the image. This prevents the procedure you told us to work. Please provide us a reproducible bug report. I ended up writing my own Dockerfile for this. https://github.com/shyouhei/docker-library/blob/master/%2313524/Dockerfile
- I am able to reproduce the bug now, and agree with @wanbe. I think this is either Alpine's or jemalloc's fault (or both).
The tiny C source code that comes with my Dockerfile is a file to generate SEGV without the needs of ruby. So at least I can say this has nothing to do with ruby. Please report this to alpine, to check if they support jemalloc or not. If they think it's ruby who's wrong, please tell us so. I'll take a deeper look at it.
All, I modified Shyouhei's Dockerfile to use alpine3.7 and jemalloc 5.0.1 and it no longer segfaults:
FROM ruby:2.4.4-alpine3.7
Step 8/10 : ADD segv.c /tmp/segv.c
---> be86245150aa
Step 9/10 : RUN gcc -ljemalloc segv.c && ./a.out; true
---> Running in 2454384e2cfc
Removing intermediate container 2454384e2cfc
---> ffb021513ffa
Step 10/10 : CMD gdb a.out core
---> Running in 039469e738f9
Removing intermediate container 039469e738f9
---> 01fdb4cf3190
Successfully built 01fdb4cf3190
I would suggest trying Alpine 3.7 and see if you still have problems.
I used this Docker file (https://github.com/t-anjan/ruby/blob/jemalloc/2.4/alpine3.7/Dockerfile) which uses Alpine 3.7 and jemalloc 5.0.1 from the alpine repositories.
It still threw the same error.
./miniruby: [BUG] Segmentation fault at 0x00000000001ec5b8
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux-musl]
-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0003 E:000500 (none) [FINISH]
-- Machine register context ------------------------------------------------
RIP: 0x00007fdc27b30520 RBP: 0x0000557e3d8b7980 RSP: 0x00007ffe157203b0
RAX: 0x00000000001ec5b8 RBX: 0x0000557e3d8b6068 RCX: 0x0000000000000000
RDX: 0x0000000000000070 RDI: 0x0000557e3d8b6197 RSI: 0x0000000000000001
R8: 0x0000000000000000 R9: 0x0000557e00000000 R10: 0x0000557e3d8b6080
R11: 0x0000000000000008 R12: 0x0000557e3d8b60e8 R13: 0x0000557e3d8b6220
R14: 0x0000557e3d8b6088 R15: 0x0000557e00000000 EFL: 0x0000000000010206
-- Other runtime information -----------------------------------------------
* Loaded script: ./miniruby
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
* Process memory map:
557e3bdb8000-557e3c0a0000 r-xp 00000000 08:01 5266190 /usr/src/ruby/miniruby
557e3c29f000-557e3c2a5000 r--p 002e7000 08:01 5266190 /usr/src/ruby/miniruby
557e3c2a5000-557e3c2a6000 rw-p 002ed000 08:01 5266190 /usr/src/ruby/miniruby
557e3c2a6000-557e3c2b4000 rw-p 00000000 00:00 0
557e3d8b6000-557e3d8b8000 rw-p 00000000 00:00 0 [heap]
7fdc26b43000-7fdc275c3000 rw-p 00000000 00:00 0
7fdc275c3000-7fdc277d3000 r-xp 00000000 08:01 5252956 /usr/lib/libgcc_s.so.1
7fdc277d3000-7fdc277d4000 r--p 00010000 08:01 5252956 /usr/lib/libgcc_s.so.1
7fdc277d4000-7fdc277d5000 rw-p 00011000 08:01 5252956 /usr/lib/libgcc_s.so.1
7fdc277d5000-7fdc27b15000 r-xp 00000000 08:01 5252961 /usr/lib/libstdc++.so.6.0.22
7fdc27b15000-7fdc27b23000 r--p 00140000 08:01 5252961 /usr/lib/libstdc++.so.6.0.22
7fdc27b23000-7fdc27b24000 rw-p 0014e000 08:01 5252961 /usr/lib/libstdc++.so.6.0.22
7fdc27b24000-7fdc27b27000 rw-p 00000000 00:00 0
7fdc27b27000-7fdc27d67000 r-xp 00000000 08:01 5259166 /usr/lib/libjemalloc.so.2
7fdc27d67000-7fdc27d6c000 r--p 00040000 08:01 5259166 /usr/lib/libjemalloc.so.2
7fdc27d6c000-7fdc27d6d000 rw-p 00045000 08:01 5259166 /usr/lib/libjemalloc.so.2
7fdc27d6d000-7fdc27f7c000 rw-p 00000000 00:00 0
7fdc27f7c000-7fdc28005000 r-xp 00000000 08:01 5776385 /lib/ld-musl-x86_64.so.1
7fdc281fc000-7fdc281fe000 ---p 00000000 00:00 0
7fdc281fe000-7fdc28204000 rw-p 00000000 00:00 0
7fdc28204000-7fdc28205000 r--p 00088000 08:01 5776385 /lib/ld-musl-x86_64.so.1
7fdc28205000-7fdc28206000 rw-p 00089000 08:01 5776385 /lib/ld-musl-x86_64.so.1
7fdc28206000-7fdc28209000 rw-p 00000000 00:00 0
7ffe14f23000-7ffe15722000 rw-p 00000000 00:00 0 [stack]
7ffe157ae000-7ffe157b1000 r--p 00000000 00:00 0 [vvar]
7ffe157b1000-7ffe157b3000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
./miniruby: [BUG] Segmentation fault at 0x000000000005d9e8
ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux-musl]
-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0003 E:001df0 (none) [FINISH]
-- Machine register context ------------------------------------------------
RIP: 0x00007f2834591520 RBP: 0x000055fe0bb3d980 RSP: 0x00007ffe23b4cfd0
RAX: 0x000000000005d9e8 RBX: 0x000055fe0bb3c068 RCX: 0x0000000000000000
RDX: 0x0000000000000070 RDI: 0x000055fe0bb3c197 RSI: 0x0000000000000001
R8: 0x0000000000000000 R9: 0x000055fe00000000 R10: 0x000055fe0bb3c080
R11: 0x0000000000000008 R12: 0x000055fe0bb3c0e8 R13: 0x000055fe0bb3c220
R14: 0x000055fe0bb3c088 R15: 0x000055fe00000000 EFL: 0x0000000000010202
-- Other runtime information -----------------------------------------------
* Loaded script: ./miniruby
* Loaded features:
0 enumerator.so
1 thread.rb
2 rational.so
3 complex.so
* Process memory map:
55fe0a0da000-55fe0a3c2000 r-xp 00000000 08:01 5266190 /usr/src/ruby/miniruby
55fe0a5c1000-55fe0a5c7000 r--p 002e7000 08:01 5266190 /usr/src/ruby/miniruby
55fe0a5c7000-55fe0a5c8000 rw-p 002ed000 08:01 5266190 /usr/src/ruby/miniruby
55fe0a5c8000-55fe0a5d6000 rw-p 00000000 00:00 0
55fe0bb3c000-55fe0bb3e000 rw-p 00000000 00:00 0 [heap]
7f28335a4000-7f2834024000 rw-p 00000000 00:00 0
7f2834024000-7f2834234000 r-xp 00000000 08:01 5252956 /usr/lib/libgcc_s.so.1
7f2834234000-7f2834235000 r--p 00010000 08:01 5252956 /usr/lib/libgcc_s.so.1
7f2834235000-7f2834236000 rw-p 00011000 08:01 5252956 /usr/lib/libgcc_s.so.1
7f2834236000-7f2834576000 r-xp 00000000 08:01 5252961 /usr/lib/libstdc++.so.6.0.22
7f2834576000-7f2834584000 r--p 00140000 08:01 5252961 /usr/lib/libstdc++.so.6.0.22
7f2834584000-7f2834585000 rw-p 0014e000 08:01 5252961 /usr/lib/libstdc++.so.6.0.22
7f2834585000-7f2834588000 rw-p 00000000 00:00 0
7f2834588000-7f28347c8000 r-xp 00000000 08:01 5259166 /usr/lib/libjemalloc.so.2
7f28347c8000-7f28347cd000 r--p 00040000 08:01 5259166 /usr/lib/libjemalloc.so.2
7f28347cd000-7f28347ce000 rw-p 00045000 08:01 5259166 /usr/lib/libjemalloc.so.2
7f28347ce000-7f28349dd000 rw-p 00000000 00:00 0
7f28349dd000-7f2834a66000 r-xp 00000000 08:01 5776385 /lib/ld-musl-x86_64.so.1
7f2834c5d000-7f2834c5f000 ---p 00000000 00:00 0
7f2834c5f000-7f2834c65000 rw-p 00000000 00:00 0
7f2834c65000-7f2834c66000 r--p 00088000 08:01 5776385 /lib/ld-musl-x86_64.so.1
7f2834c66000-7f2834c67000 rw-p 00089000 08:01 5776385 /lib/ld-musl-x86_64.so.1
7f2834c67000-7f2834c6a000 rw-p 00000000 00:00 0
7ffe23350000-7ffe23b4f000 rw-p 00000000 00:00 0 [stack]
7ffe23b69000-7ffe23b6c000 r--p 00000000 00:00 0 [vvar]
7ffe23b6c000-7ffe23b6e000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
make: *** [uncommon.mk:643: .rbconfig.time] Aborted (core dumped)
make: *** Waiting for unfinished jobs....
make: *** [uncommon.mk:854: encdb.h] Aborted (core dumped)
Any suggestions?
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0