Uploaded image for project: 'Couchbase C client library libcouchbase'
  1. Couchbase C client library libcouchbase
  2. CCBC-275

Abort in ringbuffer_consumed() when stopping server or timeout

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 2.2.0
    • 2.0.6, 2.1.3
    • library
    • Security Level: Public
    • None

    Description

      With the fix I provided for CCBC-274, stability of libcouchbase C client is much better in situations where a CB server is stopped. However, we still get incidental crashes on either stopping a server or timeout due to high load on the system.

      Program terminated with signal 6, Aborted(gdb) where
      #0 0x00007f7407bbf8e5 in raise () from /lib64/libc.so.6
      #1 0x00007f7407bc10c5 in abort () from /lib64/libc.so.6
      #2 0x00007f740997269a in ringbuffer_consumed (buffer=<value optimized out>, nb=41) at src/ringbuffer.c:263
      #3 0x00007f7409973c5c in lcb_purge_single_server (server=0x7f73b0002208, error=LCB_ETIMEDOUT) at src/server.c:338
      #4 0x00007f74099758d1 in lcb_server_timeout_handler (sock=<value optimized out>, which=<value optimized out>, arg=<value optimized out>) at src/timeout.c:38
      #5 0x00007f7409b8cb44 in event_base_loop () from /usr/lib64/libevent-1.4.so.2
      #6 0x000000000046e476 in con_thr (arg=0x1471218) at src/store_couchbase.c:2659
      #7 0x00007f7407f27851 in start_thread () from /lib64/libpthread.so.0
      #8 0x00007f7407c7594d in clone () from /lib64/libc.so.6
      (gdb) up
      #1 0x00007f7407bc10c5 in abort () from /lib64/libc.so.6
      (gdb) up
      #2 0x00007f740997269a in ringbuffer_consumed (buffer=<value optimized out>, nb=41) at src/ringbuffer.c:263
      263 src/ringbuffer.c: No such file or directory.
      in src/ringbuffer.c
      (gdb) p n
      $2 = 0
      (gdb) up
      #3 0x00007f7409973c5c in lcb_purge_single_server (server=0x7f73b0002208, error=LCB_ETIMEDOUT) at src/server.c:338
      338 src/server.c: No such file or directory.
      in src/server.c
      (gdb) p req
      $1 = {request =

      {magic = 128 '\200', opcode = 148 '\224', keylen = 3328, extlen = 4 '\004', datatype = 0 '\000', vbucket = 52225, bodylen = 285212672, opaque = 1347961, cas = 0}

      ,
      bytes = "\200\224\000\r\004\000\001\314\000\000\000\021y\221\024\000\000\000\000\000\000\000\000"}

      336 ringbuffer_consumed(stream, packetsize);
      337 if (mirror)

      { 338 ringbuffer_consumed(mirror, packetsize); 339 }

      So the crash is caused by the following abort in ringbuffer_consumed() :

      lcb_size_t n = ringbuffer_read(buffer, NULL, nb);
      if (n != nb)

      { abort(); }

      (n = 0, nb = 41)
      Apparently, ringbuffer_read() returning 0 instead of the number of expected bytes is possible in some situations and should not trigger an abort.

      Attachments

        For Gerrit Dashboard: CCBC-275
        # Subject Branch Project Status CR V

        Activity

          People

            mnunberg Mark Nunberg (Inactive)
            penacho Robert Groenenberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty