Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-149

sigsegv whtn connecting to replica set

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Critical - P2 Critical - P2
    • None
    • 0.6
    • None
    • None
    • amazon ec2, 64bit

    Description

      I'm attempting to connect to a replica set.
      The connection is failing (for whatever reason, I think because the first address listed is not a primary), but at some point, the program fails itself. Here is the stack trace, and some peeked values.
      I suspect something's going wrong in the mongo_cursor_next() function that messes up the data.

      This is off of e1642ecf18f1d447f0b509f86d79df37df10e064

      Program terminated with signal 11, Segmentation fault.
      #0  0xb7668616 in ?? () from /lib/i386-linux-gnu/tls/i686/nosegneg/libc.so.6
      (gdb) bt
      #0  0xb7668616 in ?? () from /lib/i386-linux-gnu/tls/i686/nosegneg/libc.so.6
      #1  0xb778cc91 in ?? () from /usr/lib/libefence.so.0
      #2  0xb778ce9a in EF_Exit () from /usr/lib/libefence.so.0
      #3  0xb778ca6f in Page_Create () from /usr/lib/libefence.so.0
      #4  0xb778c87b in memalign () from /usr/lib/libefence.so.0
      #5  0xb778c32d in malloc () from /usr/lib/libefence.so.0
      #6  0xb77c03e5 in bson_malloc (size=1852793701) at src/bson.c:982
      #7  0xb77c0488 in _bson_init_size (size=1852793701, b=0xa1cb8c90)
          at src/bson.c:620
      #8  bson_init_size (b=0xa1cb8c90, size=1852793701) at src/bson.c:631
      #9  0xb77c6f64 in mongo_find_one (conn=0xb74f394c, 
          ns=0x5152bff4 "admin.$cmd", query=0xa1cb8ea4, fields=0xa1cb8d2c, 
          out=0xa1cb8c90) at src/mongo.c:1235
      #10 0xb77c7c1a in mongo_run_command (conn=0xb74f394c, db=0xb77ca3fe "admin", 
          command=0xa1cb8ea4, out=0xa1cb8e08) at src/mongo.c:1477
      #11 0xb77c7f95 in mongo_simple_int_command (conn=0xb74f394c, 
          db=0xb77ca3fe "admin", cmdstr=0xb77ca404 "ismaster", arg=1, 
          realout=0xa1cb8f9c) at src/mongo.c:1509
      #12 0xb77c845a in mongo_replset_check_host (conn=0xb74f394c)
          at src/mongo.c:554
      #13 mongo_replset_connect (conn=0xb74f394c) at src/mongo.c:616
      #14 0x0804c150 in check_mongo_conn (wi=0xb74f394c) at listener.c:1100
      #15 0x0804bf4a in process_packet (from=0x51665e9c) at listener.c:1042
      #16 0x0804b24b in read_from_fd (fdd=0x51665e9c) at listener.c:734
      #17 0x0804aff1 in worker_loop (arg=0xb74f394c) at listener.c:641
      #18 0xb77a0d4c in start_thread ()
         from /lib/i386-linux-gnu/tls/i686/nosegneg/libpthread.so.0
      #19 0xb76d0ace in clone ()
         from /lib/i386-linux-gnu/tls/i686/nosegneg/libc.so.6
      (gdb) frame 9
      #9  0xb77c6f64 in mongo_find_one (conn=0xb74f394c, 
          ns=0x5152bff4 "admin.$cmd", query=0xa1cb8ea4, fields=0xa1cb8d2c, 
          out=0xa1cb8c90) at src/mongo.c:1235
      1235                bson_init_size( out, bson_size( (bson *)&cursor->current ) );
      (gdb) list
      1230        mongo_cursor_set_fields( cursor, fields );
      1231        mongo_cursor_set_limit( cursor, 1 );
      1232
      1233        if ( mongo_cursor_next( cursor ) == MONGO_OK ) {
      1234            if( out ) {
      1235                bson_init_size( out, bson_size( (bson *)&cursor->current ) );
      1236                memcpy( out->data, cursor->current.data,
      1237                    bson_size( (bson *)&cursor->current ) );
      1238                out->finished = 1;
      1239            }
      (gdb) print (bson *)&cursor->current
      $1 = (bson *) 0xa1cb8b8c
      (gdb) print *(bson *)&cursor->current
      $2 = {data = 0x5152ff60 "econdary", cur = 0x0, dataSize = 0, finished = 1, 
        stack = {0 <repeats 32 times>}, stackPos = 0, err = 0, errstr = 0x0}
      (gdb) print *cursor
      $4 = {reply = 0x5152ff3c, conn = 0xb74f394c, ns = 0x5152dff4 "admin.$cmd", 
        flags = 2, seen = 1929904128, current = {data = 0x5152ff60 "econdary", 
          cur = 0x0, dataSize = 0, finished = 1, stack = {0 <repeats 32 times>}, 
          stackPos = 0, err = 0, errstr = 0x0}, err = MONGO_CURSOR_EXHAUSTED, 
        query = 0xa1cb8ea4, fields = 0xa1cb8d2c, options = 0, limit = 1, skip = 0}

      Attachments

        Activity

          People

            gregor Gregor Macadam
            pawel Pawel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: