chrissimpkins / Crunch

Insane(ly slow but wicked good) PNG image optimization
Other
3.35k stars 147 forks source link

resource_tracker UserWarning on crunch executable processing with multi-file requests (parallel execution) #100

Open chrissimpkins opened 2 years ago

chrissimpkins commented 2 years ago

Describe the bug

Python raises a multiprocessing std library UserWarning warning in std error that states something along the lines of:

"...UserWarning: resource_tracker: There appear to be 16 leaked shared_memory objects to clean up at shutdown..."

This is a known issue in Py3.8+ versions of Python multiprocessing and does not appear to be an actual error in downstream shared memory object source.

https://bugs.python.org/issue39959 https://bugs.python.org/issue38119

Possible fix in:

https://github.com/python/cpython/pull/30617

To Reproduce Install the crunch dependencies and executable on macOS, run the crunch executable with multiple png files simultaneously so that parallel processing is triggered.

Expected behavior No warning message if this is not an issue that we can address in downstream source.

chrissimpkins commented 2 years ago

I think that we just ignore the user warning until this is addressed in the standard library. See below

chrissimpkins commented 2 years ago

This appears that it may have been fixed in https://github.com/python/cpython/pull/30617

chrissimpkins commented 2 years ago

We can address it in the Python source here with the approach described in https://stackoverflow.com/a/25558333/2848172