VikParuchuri / surya

OCR, layout analysis, reading order, table recognition in 90+ languages
https://www.datalab.to
GNU General Public License v3.0
14.21k stars 882 forks source link

Surya stalls - deadlock in batch_text_detection #165

Open FireMasterK opened 3 months ago

FireMasterK commented 3 months ago

For some reason, when you use process more than one image, surya/marker stalls permanently with 0% CPU and GPU utilization. This happens randomly, and I've got this stack trace when stopping the process with Ctrl + C:

File "/home/kavin/redacted/.venv/lib/python3.12/site-packages/surya/detection.py", line 136, in batch_text_detection
with ProcessPoolExecutor(max_workers=max_workers) as executor:
File "/home/kavin/.rye/py/cpython@3.12.4/lib/python3.12/concurrent/futures/_base.py", line 647, in exit
self.shutdown(wait=True)
File "/home/kavin/.rye/py/cpython@3.12.4/lib/python3.12/concurrent/futures/process.py", line 873, in shutdown
self._executor_manager_thread.join()
File "/home/kavin/.rye/py/cpython@3.12.4/lib/python3.12/threading.py", line 1147, in join
self._wait_for_tstate_lock()
File "/home/kavin/.rye/py/cpython@3.12.4/lib/python3.12/threading.py", line 1167, in _wait_for_tstate_lock
if lock.acquire(block, timeout):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
VikParuchuri commented 3 months ago

Interesting, I haven't seen this before. Definitely sounds like some kind of deadlock situation. I'll see if I can reproduce.