damccorm commented on code in PR #40822:
URL: https://github.com/apache/beam/pull/40822#discussion_r4497378263


##########
sdks/python/apache_beam/utils/multi_process_shared.py:
##########
@@ -150,8 +152,22 @@ def release(self, proxy):
   def unsafe_hard_delete(self):
     with self.lock:
       if self.initialied:
+        obj = self.obj
         del self.obj
         self.initialied = False
+        # When hard-deleting in a spawned server process that exits via
+        # os._exit(0), an in-flight RPC thread (e.g. a timed-out call) may
+        # still hold a stack reference to `obj`, preventing CPython from
+        # invoking `obj.__del__()` before `os._exit(0)`.
+        if (self._hard_delete_callback is not None and
+            sys.getrefcount(obj) > 2 and hasattr(type(obj), '__del__')):
+          try:
+            type(obj).__del__(obj)

Review Comment:
   I got rid of this, resolving this and leaving the other thread open



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to