Skip to content

Segfault on ruby_ami specs #1822

Closed
benlangfeld opened this Issue Jul 18, 2012 · 9 comments

3 participants

@benlangfeld

rubinius 2.0.0dev (1.9.3 82a2914 yyyy-mm-dd JI) [x86_64-apple-darwin11.4.0]

Steps to reproduce:

Install Ragel 6.7: http://www.complang.org/ragel/
(available on macports)

git clone git://github.com/adhearsion/ruby_ami.git
cd ruby_ami
bundle install
bundle exec rake
---------------------------------------------
CRASH: A fatal error has occurred.

Backtrace:
0   rbx                                 0x0000000104f2bc20 _ZN8rubiniusL12segv_handlerEi + 544
1   libsystem_c.dylib                   0x00007fff945a2cfa _sigtramp + 26
2   ???                                 0x000000010f7a0e18 0x0 + 4554624536
3   rbx                                 0x0000000105053156 _ZN8rubinius12NativeMethod23executor_implementationINS_11OneArgumentEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 876
4   rbx                                 0x000000010510218c _ZN8rubinius4capi27capi_funcall_backend_nativeEPNS_23NativeMethodEnvironmentEPKciPNS_6ObjectEPNS_6SymbolEmPS6_S6_ + 268
5   rbx                                 0x0000000105102a29 rb_funcall + 793
6   nio4r_ext.bundle                    0x00000001089abaf8 NIO_Monitor_close + 360
7   rbx                                 0x0000000105054570 _ZN8rubinius16GenericArguments6invokeEPNS_5StateEPNS_12NativeMethodEPNS_23NativeMethodEnvironmentERNS_9ArgumentsE + 1040
8   rbx                                 0x0000000105053f66 _ZN8rubinius12NativeMethod23executor_implementationINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 876
9   rbx                                 0x0000000104f38346 _ZN8rubinius8VMMethod11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE + 9814
10  rbx                                 0x000000010502d601 _ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE + 1013
11  rbx                                 0x000000010502d738 _ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE + 260
12  rbx                                 0x000000010502da42 _ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi + 68
13  rbx                                 0x0000000105102b41 _ZN8rubinius4capi18capi_yield_backendEPNS_23NativeMethodEnvironmentEPNS_6ObjectEmPS4_ + 225
14  rbx                                 0x000000010510311c rb_yield + 204
15  nio4r_ext.bundle                    0x00000001089b61ae NIO_Selector_monitor_callback + 174
16  nio4r_ext.bundle                    0x00000001089b14d9 ev_invoke_pending + 169
17  nio4r_ext.bundle                    0x00000001089b2350 ev_run + 1392
18  nio4r_ext.bundle                    0x00000001089b5e20 ev_loop + 32
19  nio4r_ext.bundle                    0x00000001089b5dc4 NIO_Selector_run + 164
20  nio4r_ext.bundle                    0x00000001089b5c95 NIO_Selector_select_synchronized + 117
21  rbx                                 0x0000000105109ea1 rb_ensure + 97
22  nio4r_ext.bundle                    0x00000001089b5757 NIO_Selector_synchronize + 247
23  nio4r_ext.bundle                    0x00000001089b5c01 NIO_Selector_select + 209
24  rbx                                 0x0000000105054570 _ZN8rubinius16GenericArguments6invokeEPNS_5StateEPNS_12NativeMethodEPNS_23NativeMethodEnvironmentERNS_9ArgumentsE + 1040
25  rbx                                 0x0000000105053f66 _ZN8rubinius12NativeMethod23executor_implementationINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 876
26  rbx                                 0x0000000104f3848c _ZN8rubinius8VMMethod11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE + 10140
27  rbx                                 0x000000010502530e _ZN8rubinius8VMMethod19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 862
28  rbx                                 0x0000000104f38346 _ZN8rubinius8VMMethod11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE + 9814
29  rbx                                 0x000000010502530e _ZN8rubinius8VMMethod19execute_specializedINS_16GenericArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 862
30  rbx                                 0x0000000104f38346 _ZN8rubinius8VMMethod11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE + 9814
31  rbx                                 0x0000000105025686 _ZN8rubinius8VMMethod19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 822
32  rbx                                 0x0000000104f38222 _ZN8rubinius8VMMethod11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE + 9522
33  rbx                                 0x000000010502d601 _ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE + 1013
34  rbx                                 0x000000010502d738 _ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE + 260
35  rbx                                 0x000000010502da42 _ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi + 68
36  rbx                                 0x0000000104f39441 _ZN8rubinius8VMMethod11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE + 14161
37  rbx                                 0x000000010502d601 _ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE + 1013
38  rbx                                 0x000000010502d738 _ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE + 260
39  rbx                                 0x000000010502da42 _ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi + 68
40  rbx                                 0x00000001050a6a28 _ZN8rubinius4Proc4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsE + 998
41  rbx                                 0x0000000104fcf678 _ZN8rubinius10Primitives9proc_callEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 168
42  rbx                                 0x0000000104f38346 _ZN8rubinius8VMMethod11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE + 9814
43  rbx                                 0x000000010502d601 _ZN8rubinius16BlockEnvironment19execute_interpreterEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE + 1013
44  rbx                                 0x000000010502d738 _ZN8rubinius16BlockEnvironment6invokeEPNS_5StateEPNS_9CallFrameEPS0_RNS_9ArgumentsERNS_15BlockInvocationE + 260
45  rbx                                 0x000000010502da42 _ZN8rubinius16BlockEnvironment4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsEi + 68
46  rbx                                 0x00000001050a6a28 _ZN8rubinius4Proc4callEPNS_5StateEPNS_9CallFrameERNS_9ArgumentsE + 998
47  rbx                                 0x0000000104fcf678 _ZN8rubinius10Primitives9proc_callEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 168
48  rbx                                 0x0000000104f386a4 _ZN8rubinius8VMMethod11interpreterEPNS_5StateEPS0_PNS_20InterpreterCallFrameE + 10676
49  rbx                                 0x0000000105025686 _ZN8rubinius8VMMethod19execute_specializedINS_11NoArgumentsEEEPNS_6ObjectEPNS_5StateEPNS_9CallFrameEPNS_10ExecutableEPNS_6ModuleERNS_9ArgumentsE + 822
50  rbx                                 0x00000001050584b3 _ZN8rubinius6Object4sendEPNS_5StateEPNS_9CallFrameEPNS_6SymbolEb + 165
51  rbx                                 0x00000001050b2b87 _ZN8rubinius6Thread13in_new_threadEPv + 295
52  libsystem_c.dylib                   0x00007fff9454e8bf _pthread_start + 335
53  libsystem_c.dylib                   0x00007fff94551b75 thread_start + 13
@dbussink
Rubinius member

I've tried to reproduce this error, but it passes for me without crashing. Does it crash for you on every run, or does it only happen sporadically?

@benlangfeld

Every time. Unfortunately, there's nothing in that trace that means much to me. Any pointers on debugging?

@brixen
Rubinius member
brixen commented Jul 31, 2012

I cannot repro it either. Is that backtrace always the same?

You'll note that NIO_Monitor_close is doing an rb_funcall. Looking at that function in gems/1.9/gems/nio4r-0.4.0/ext/nio4r/monitor.c, there is only a single rb_funcall.

Further up in the backtrace, note the call to (essentially) rubinius::NativeMethod::exector_implementation_OneArgument. This matches the arity of NIO::Selector#deregister (gems/1.9/gems/nio4r-0.4.0/lib/nio/selector.rb). Looking at the implementation in rbx (vm/builtin/nativemethod.cpp), there's only a couple things that could go wrong. You'll need to compile rbx with DEV=1 (build from a clone with './configure --default-version=1.9; DEV=1 rake build', put clone_dir/bin in PATH, then run rbx normally, except use rbx -S bundle or put clone_dir/gems/1.9/bin in PATH). Finally, run 'gdb --args rbx -G -S rake'

@dbussink
Rubinius member

Perhaps related to celluloid/nio4r#8

@dbussink
Rubinius member

@benlangfeld Does your issue involve multiple threads? Or is it all single threaded?

@benlangfeld

It's using celluloid actors, so multiple threads.

@dbussink
Rubinius member

If this is also using Celluloid I'm pretty sure it's due to the issue in nio4r then. I opened celluloid/nio4r#9 for a fix for this issue.

@benlangfeld benlangfeld referenced this issue in celluloid/nio4r Nov 11, 2012
Closed

rbx segfault #7

@benlangfeld

Fixed in 2.0.0-rc1

@dbussink
Rubinius member

Fix in nio4r that is ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.