Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1109

OpenSSL call from Mongo 2.2.4 not threadsafe

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 12_01_17
    • Affects Version/s: 2.2.4
    • Component/s: Connections
    • Environment:
      ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
      OpenSSL 1.0.1f 6 Jan 2014

      I am running 5 ruby threads on the same server, all making regular calls to mongo using the ssl option and they throw this seg fault around 30% of the time. Any help would be appreciated.

      /opt/rbenv/versions/2.3.0/lib/ruby/2.3.0/openssl/buffering.rb:57: [BUG] Segmentation fault at 0x007fde66b1e550
      ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

      – Control frame information -----------------------------------------------
      c:0019 p:---- s:0075 e:000074 CFUNC :sysread
      c:0018 p:0020 s:0071 e:000069 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/2.3.0/openssl/buffering.rb:57
      c:0017 p:0090 s:0067 e:000066 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/2.3.0/openssl/buffering.rb:98
      c:0016 p:0012 s:0061 e:000060 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/socket.rb:172
      c:0015 p:0010 s:0057 e:000056 BLOCK /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/socket.rb:123
      c:0014 p:0008 s:0053 e:000052 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/socket.rb:191
      c:0013 p:0009 s:0049 e:000048 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/socket.rb:122
      c:0012 p:0030 s:0045 e:000042 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/protocol/message.rb:113
      c:0011 p:0033 s:0035 e:000034 BLOCK /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor/connection.rb:56
      c:0010 p:0026 s:0032 e:000031 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/connectable.rb:91
      c:0009 p:0009 s:0028 e:000027 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor/connection.rb:54
      c:0008 p:0027 s:0025 e:000024 BLOCK /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:163 [FINISH]
      c:0007 p:---- s:0021 e:000020 CFUNC :synchronize
      c:0006 p:0011 s:0018 e:000017 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:160
      c:0005 p:0023 s:0015 e:000012 METHOD /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:66
      c:0004 p:0017 s:0010 e:000009 BLOCK /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:118 [FINISH]
      c:0003 p:---- s:0008 e:000007 CFUNC :loop
      c:0002 p:0009 s:0005 e:000004 BLOCK /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:116 [FINISH]
      c:0001 p:---- s:0002 e:000001 (none) [FINISH]

      – Ruby level backtrace information ----------------------------------------
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:116:in `block in run!'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:116:in `loop'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:118:in `block (2 levels) in run!'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:66:in `scan!'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:160:in `ismaster'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:160:in `synchronize'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor.rb:163:in `block in ismaster'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor/connection.rb:54:in `ismaster'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/connectable.rb:91:in `ensure_connected'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/server/monitor/connection.rb:56:in `block in ismaster'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/protocol/message.rb:113:in `deserialize'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/socket.rb:122:in `read'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/socket.rb:191:in `handle_errors'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/socket.rb:123:in `block in read'
      /opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/mongo-2.2.4/lib/mongo/socket.rb:172:in `read_from_socket'
      /opt/rbenv/versions/2.3.0/lib/ruby/2.3.0/openssl/buffering.rb:98:in `read'
      /opt/rbenv/versions/2.3.0/lib/ruby/2.3.0/openssl/buffering.rb:57:in `fill_rbuff'
      /opt/rbenv/versions/2.3.0/lib/ruby/2.3.0/openssl/buffering.rb:57:in `sysread'

      – Machine register context ------------------------------------------------
      RIP: 0x00007fde66b1e550 RBP: 0x00007fde5d1f2b1c RSP: 0x00007fde592a14c8
      RAX: 0x00007fde66b1e550 RBX: 0x00007fde65cf9480 RCX: 0x0000000000000005
      RDX: 0x0000000000004000 RDI: 0x00007fde65cf9480 RSI: 0x00007fde40000a20
      R8: 0x0000000000000000 R9: 0x0000000000000036 R10: 0x0000000000000000
      R11: 0x0000000000000206 R12: 0x00007fde668fa880 R13: 0x00007fde6550d710
      R14: 0x00007fde61de2aa0 R15: 0x00007fde668fa880 EFL: 0x0000000000010246

      – C level backtrace information -------------------------------------------
      /opt/rbenv/versions/2.3.0/bin/ruby(rb_vm_bugreport+0x51f) [0x7fde602ee21f] vm_dump.c:688
      /opt/rbenv/versions/2.3.0/bin/ruby(rb_bug_context+0xd0) [0x7fde602c89b0] error.c:435
      /opt/rbenv/versions/2.3.0/bin/ruby(sigsegv+0x3e) [0x7fde601c446e] signal.c:890
      /lib/x86_64-linux-gnu/libpthread.so.0 [0x7fde5fca4340]
      [0x7fde66b1e550]

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            alexanderbrowne Alexander Browne
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: