docling-project / docling-project/docling
bus error: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
### Bug
DocumentConverter._convert abruptly crashes with this error:
```
zsh: bus error path/to/.venv/bin/python
/path/to/.local/share/uv/python/cpython-3.11.14-macos-aarch64-none/lib/python3.11/multiprocessing/resource_tracker.py:254: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
warnings.warn('resource_tracker: There appear to be %d '
```
I've investigated the error and found:
1. It does not happen if I set a python debugger breakpoint in the calling code
2. I used printouts to understand where the code crashes and found that [accessing the input_batch here](https://github.com/docling-project/docling/blob/main/docling/document_converter.py#L461) leads to the crash:
```py
for item in map(
process_func,
input_batch,
):
elapsed = time.monotonic() - start_time
start_time = time.monotonic()
_log.info(
f"Finished converting document {item.input.file.name} in {elapsed:.2f} sec."
)
yield item
```
3. `settings.perf.doc_batch_concurrency=1`, `settings.perf.doc_batch_size=1`
### Steps to reproduce
call `DocumentConverter.convert(PDF file path)` on MAC OS ARM64 (M1)
### Docling version
[uv_pip_list.txt](https://github.com/user-attachments/files/24864022/uv_pip_list.txt)
### Python version
3.11.14
Contributor guide
Assessment
This issue has not been assessed yet.