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


##########
sdks/python/apache_beam/utils/multi_process_shared.py:
##########
@@ -439,7 +446,17 @@ def unsafe_hard_delete(self):
       to this object exist, or (b) you are ok with all existing references to
       this object throwing strange errors when derefrenced.
     """
-    self._get_manager().unsafe_hard_delete_singleton(self._tag)
+    manager = self._get_manager(create_if_missing=False)

Review Comment:
   Could concurrent hard deletes of the same tag raise `FileNotFoundError` now 
that `_get_manager(create_if_missing=False)` is outside the `try`?
   
   1. Caller A's delete makes the server remove its address file and exit.
   2. Caller B had already read the address, so its connect fails and retries.
   3. B's `os.unlink(address_file)` in `_get_manager` then raises, because the 
file is already gone.
   
   Potentially move the lookup back inside the `try`?
   
   ```python
       try:
         manager = self._get_manager(create_if_missing=False)
         if manager is not None:
           manager.unsafe_hard_delete_singleton(self._tag)
       except (EOFError, OSError, BrokenPipeError):
         # Expected when a spawned server process exits via os._exit(0) before
         # sending an RPC reply, or removes its address file while another
         # caller is still connecting to it.
         pass
       finally:
         self._manager = None
   ```
   
   



-- 
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