You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/12 02:53:39 UTC

[GitHub] [pulsar] zbentley commented on pull request #16535: [fix] [c++ and python client] Better Python garbage collection management for C++-owned objects

zbentley commented on PR #16535:
URL: https://github.com/apache/pulsar/pull/16535#issuecomment-1181255243

   
   **WIP notes**: the segfault is fixed as expected, but threads now leak if the log level's low enough to result in at least one call to the Python logger's `_log` internal function. 
   
   Pull on the thread of "why" and you arrive at an unconditional call to `threading.currentThread` down in Python's logging machinery. If that method is called inside a Pulsar thread, the thread leaks thereafter; somehow, a reference to it is manipulated such that the thread doesn't go away on the system. 
   
   Fortunately, there's a way to turn that off. Unfortunately, that's the `logging.logThreads = 1` or `= 0` module global. That's a weird and sad Python config API--not only is there no way to modify it in a race-proof way, but boost-python doesn't make it easy to manipulate the value within the client's C++ code, so the usual `import("logging").attr("logThreads") = object(0)` doesn't seem to work (at least for me, my C++ is basically nonexistent, and my Boost is worse). 
   
   The easiest thing I know how to do is write a Python wrapper for the logger that temporarily manipulates that value, which I'l try next.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org