Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-1403

Crash at shutdown when using python logging

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 4.0.3
    • None
    • None
    • 1

    Description

      We seem to be logging in the cxx client after the cluster is shutdown, and this can occur after logging has shutdown the logger somehow. Also - and even if this isn't an issue, we can avoid having the 2 mutex issue (one in spdlog, and the GIL) by extending the spdlog::sync instead of spdlog::base_sync. This can eliminate the worker thread+queue approach entirely (though – we need to consider the performance).

      One thing worth wondering about is this: How do we know when the client is done logging? That should happen when the c++ logger sync object is destroyed. So the issue will be if python is finalizing (and already destroyed the logger - whose refcount was still 1), while the client tries to log in another thread. We can avoid this by making the pycbc_logger_sync a PyObject or wrapping it in one and dealing with things in the dealloc method. Like, if we are dealloc-ing, and the spdlog sink has not been destroyed, we remove it from spdlog and shutdown. We'd miss that last log, but never crash. We could pause as well, but I'm uncomfortable with that solution. Probably the destructor for the c++ sink could signal the wrapper that it is done? Stuff like that sounds too error-prone.

      So – lets make it safe and if we don't get that last log message, that's fine. Then ponder the lost message at the end separately.

      Attachments

        Issue Links

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

          Activity

            People

              jared.casey Jared Casey
              david.kelly David Kelly (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty