Skip to content
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

SIGSEGV on 32bit linux #235

Closed
yyamano opened this issue Nov 30, 2016 · 0 comments
Closed

SIGSEGV on 32bit linux #235

yyamano opened this issue Nov 30, 2016 · 0 comments

Comments

@yyamano
Copy link
Collaborator

yyamano commented Nov 30, 2016

I got SIGSEGV on 32bit linux when run ngx_mruby/test/t/ngx_mruby.rb

RuntimeError: ngx_mruby - stream tcp load balancer [127.0.0.1:12346 to 127.0.0.1:58081 which changed from 127.0.0.1:58080 by mrub\
y] => sysread failed
Total: 70
   OK: 69
   KO: 0
Crash: 1
 Time: 1.181836 seconds

trace:
        [0] /home/vagrant/ngx_mruby/mruby_test/build/mrbgems/mruby-simpletest/mrblib/mrb_simpletest.rb:240:in SimpleTest.report
        [1] ../test/t/ngx_mruby.rb:538
/home/vagrant/ngx_mruby/mruby_test/build/mrbgems/mruby-simpletest/mrblib/mrb_simpletest.rb:240: RuntimeError

Here is the gdb backtrace:

vagrant@vagrant-ubuntu-trusty-32:~$ curl http://localhost:12346/mruby
Program received signal SIGSEGV, Segmentation fault.
0x08174c07 in ngx_stream_mrb_errlogger (mrb=0x862cb10, self=...) at /home/vagrant/ngx_mruby/src/stream/ngx_stream_mruby_core.c:57
57	  ngx_log_error((ngx_uint_t)log_level, s->connection->log, 0, "%s", mrb_str_to_cstr(mrb, msg));
(gdb) bt
#0  0x08174c07 in ngx_stream_mrb_errlogger (mrb=0x862cb10, self=...)
    at /home/vagrant/ngx_mruby/src/stream/ngx_stream_mruby_core.c:57
#1  0x0818e1ac in mrb_vm_exec (mrb=mrb@entry=0x862cb10, proc=<optimized out>, proc@entry=0x865a058, pc=0x8694818)
    at /home/vagrant/ngx_mruby/mruby/src/vm.c:1150
#2  0x08193d8f in mrb_vm_run (stack_keep=2, self=..., proc=0x865a058, mrb=0x862cb10)
    at /home/vagrant/ngx_mruby/mruby/src/vm.c:759
#3  mrb_run (mrb=0x862cb10, proc=0x865a058, self=...) at /home/vagrant/ngx_mruby/mruby/src/vm.c:2424
#4  0x08174807 in ngx_stream_mruby_handler (s=0x8561870) at /home/vagrant/ngx_mruby/src/stream/ngx_stream_mruby_module.c:681
#5  0x081519fd in ngx_stream_core_generic_phase (s=0x8561870, ph=0x868578c) at src/stream/ngx_stream_core_module.c:176
#6  0x08151977 in ngx_stream_core_run_phases (s=0x8561870) at src/stream/ngx_stream_core_module.c:153
#7  0x08151485 in ngx_stream_session_handler (rev=0x86886a8) at src/stream/ngx_stream_handler.c:292
#8  0x08151123 in ngx_stream_init_connection (c=0x868b088) at src/stream/ngx_stream_handler.c:201
#9  0x080bff63 in ngx_event_accept (ev=0x8688618) at src/event/ngx_event_accept.c:309
#10 0x080cc857 in ngx_epoll_process_events (cycle=0x85623e8, timer=4294967295, flags=1)
    at src/event/modules/ngx_epoll_module.c:907
#11 0x080bd0f1 in ngx_process_events_and_timers (cycle=0x85623e8) at src/event/ngx_event.c:242
#12 0x080c9434 in ngx_single_process_cycle (cycle=0x85623e8) at src/os/unix/ngx_process_cycle.c:309
#13 0x080902e3 in main (argc=1, argv=0xbffff744) at src/core/nginx.c:364

I guess the root cause is same as #229. Will fix it as a lunch time hack:-)

Breakpoint 2, ngx_stream_mruby_handler (s=0x8561870) at /home/vagrant/ngx_mruby/src/stream/ngx_stream_mruby_module.c:674
674	  ngx_stream_mruby_srv_conf_t *mscf = ngx_stream_get_module_srv_conf(s, ngx_stream_mruby_module);
(gdb) p s->connection
$10 = (ngx_connection_t *) 0x868b088
(gdb) p *(s->connection)
$11 = {data = 0x8561870, read = 0x86886a8, write = 0x85e1c20, fd = 18, recv = 0x80c4d6f <ngx_unix_recv>, 
  send = 0x80c5583 <ngx_unix_send>, recv_chain = 0x80c4fde <ngx_readv_chain>, send_chain = 0x80cca72 <ngx_linux_sendfile_chain>, 
  listening = 0x8685c80, sent = 0, log = 0x8561838, pool = 0x8561800, type = 1, sockaddr = 0x8561828, socklen = 16, addr_text = {
    len = 9, data = 0x8561860 "127.0.0.1"}, proxy_protocol_addr = {len = 0, data = 0x0}, proxy_protocol_port = 0, ssl = 0x0, 
  local_sockaddr = 0x86857a8, local_socklen = 16, buffer = 0x0, queue = {prev = 0x0, next = 0x0}, number = 1, requests = 0, 
  buffered = 0, log_error = 2, timedout = 0, error = 0, destroyed = 0, idle = 0, reusable = 0, close = 0, shared = 0, 
  sendfile = 0, sndlowat = 0, tcp_nodelay = 0, tcp_nopush = 0, need_last_buf = 0}
(gdb) p sizeof(*(s->connection))
$12 = 120
Breakpoint 1, ngx_stream_mrb_errlogger (mrb=0x862cb10, self=...) at /home/vagrant/ngx_mruby/src/stream/ngx_stream_mruby_core.c:30
30	  ngx_stream_mruby_internal_ctx_t *ictx = mrb->ud;
(gdb) n
31	  ngx_stream_session_t *s = ictx->s;
(gdb) n
33	  if (s == NULL) {
(gdb) p s->connection
$13 = (ngx_connection_t *) 0x868b088
(gdb) p *(s->connection)
$14 = {data = 0x8561870, read = 0x86886a8, write = 0x85e1c20, fd = 18, recv = 0x80c4d6f <ngx_unix_recv>, 
  send = 0x80c5583 <ngx_unix_send>, recv_chain = 0x80c4fde <ngx_readv_chain>, send_chain = 0x80cca72 <ngx_linux_sendfile_chain>, 
  listening = 0x8685c80, sent = 0, log = 0x0, pool = 0x8561838, type = 139859968, sockaddr = 0x1, socklen = 139860008, 
  addr_text = {len = 16, data = 0x9 <error: Cannot access memory at address 0x9>}, proxy_protocol_addr = {len = 139860064, 
    data = 0x0}, proxy_protocol_port = 0, ssl = 0x0, local_sockaddr = 0x0, local_socklen = 141055912, buffer = 0x10, queue = {
    prev = 0x0, next = 0x0}, number = 0, requests = 1, buffered = 0, log_error = 0, timedout = 0, error = 0, destroyed = 0, 
  idle = 0, reusable = 0, close = 0, shared = 0, sendfile = 0, sndlowat = 0, tcp_nodelay = 0, tcp_nopush = 0, need_last_buf = 0}
(gdb) p sizeof(*(s->connection))
$15 = 116
matsumotory added a commit that referenced this issue Nov 30, 2016
Adjust include order to fix SIGSEGV on 32bit linux. Fixed #235.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant