Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-52610

Investigate write failure handling in MutationLog

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • Morpheus
    • 7.0.3
    • couchbase-bucket
    • None
    • 1

    Description

      Exceptions may be thrown while writing the mutation log (access log).

      void MutationLog::updateInitialBlock() {
          if (readOnly) {
              throw std::logic_error("MutationLog::updateInitialBlock: Not valid on "
                                     "a read-only log");
          }
          if (!isOpen()) {
              throw std::logic_error("MutationLog::updateInitialBlock: Not valid on "
                                     "a closed log");
          }
          needWriteAccess();
       
          std::vector<uint8_t> buf(MIN_LOG_HEADER_SIZE);
          memcpy(buf.data(), &headerBlock, sizeof(headerBlock));
       
          ssize_t byteswritten = pwrite(file, buf.data(), buf.size(), 0);
          if (byteswritten != ssize_t(buf.size())) {
              throw WriteException("Failed to update header block");
          }
      }
      

      These have been seen to go uncaught and crash memcached

      [ns_server:info,2022-06-12T02:00:01.761Z,babysitter_of_ns_1@cb.local:<0.129.0>:ns_port_server:log:221]memcached<0.129.0>: 2022-06-12T02:00:01.559986+00:00 CRITICAL *** Fatal error encountered during exception handling ***
      memcached<0.129.0>: 2022-06-12T02:00:01.562845+00:00 CRITICAL Caught unhandled std::exception-derived exception. what(): Failed to update header block
      memcached<0.129.0>: terminate called after throwing an instance of 'MutationLog::WriteException'
      memcached<0.129.0>:   what():  Failed to update header block
       
      [ns_server:info,2022-06-12T02:00:02.002Z,babysitter_of_ns_1@cb.local:<0.129.0>:ns_port_server:log:221]memcached<0.129.0>: 2022-06-12T02:00:01.848051+00:00 CRITICAL Breakpad caught a crash (Couchbase version 7.0.3-7031). Writing crash dump to /opt/couchbase/var/lib/couchbase/crash/6320c9de-0d65-49b7-3d99c785-adaed8c2.dmp before terminating.
      ...
      

      Investigate catching and more cleanly handling this.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              owend Daniel Owen
              james.harrison James Harrison (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty