tvalentyn commented on issue #40673:
URL: https://github.com/apache/beam/issues/40673#issuecomment-6281137958
repro without Beam:
```
import faulthandler
import gc
import sys
import threading
from multiprocessing.managers import BaseManager
class Counter:
def __init__(self):
self.n = 0
def incr(self):
self.n += 1
return self.n
class MyManager(BaseManager):
pass
MyManager.register('Counter', Counter)
if __name__ == '__main__':
# Serve the manager from a thread of this process.
server = MyManager(address=('127.0.0.1', 0),
authkey=b'secret').get_server()
threading.Thread(target=server.serve_forever, daemon=True).start()
manager = MyManager(address=server.address, authkey=b'secret')
manager.connect()
# Run the cyclic GC often, on whichever thread happens to allocate.
gc.set_threshold(10)
def work():
for _ in range(1000):
proxy = manager.Counter()
proxy.incr()
cycle = [proxy]
cycle.append(cycle) # Only the cyclic GC can free the proxy.
t = threading.Thread(target=work, daemon=True)
t.start()
t.join(timeout=30)
if t.is_alive():
print('DEADLOCKED')
if '--stacks' in sys.argv:
faulthandler.dump_traceback(all_threads=True)
else:
print('ok')
```
--
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]