X

Python 3 – do not upgrade yet to tldextract 3.1.0

The problem

If you want to upgrade to tldextract 3.1.0 from 2.* be aware of incompatibility with concurrent pools due to its filelock usage. It will have conflicts with some multiprocessing pools.

I have discovered this issue after I upgrade it from 2.2 directly to 3.1.0 and some of my scripts using the threading pool from concurrent.features have crashed with the following errors:

concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

concurrent.futures.process._RemoteTraceback:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/concurrent/futures/process.py", line 368, in _queue_management_worker
    result_item = result_reader.recv()
  File "/usr/local/lib/python3.8/multiprocessing/connection.py", line 251, in recv
    return _ForkingPickler.loads(buf.getbuffer())
TypeError: __init__() missing 1 required positional argument: 'lock_file'

or

The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
objc[4108]: +[NSNumber initialize] may have been in progress in another thread when fork() was called.
objc[4108]: +[NSNumber initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
...
  File "/Users/dpf/.pyenv/versions/3.8.5/lib/python3.8/concurrent/futures/process.py", line 484, in _chain_from_iterable_of_lists
    for element in iterable:
  File "/Users/dpf/.pyenv/versions/3.8.5/lib/python3.8/concurrent/futures/_base.py", line 611, in result_iterator
    yield fs.pop().result()
  File "/Users/dpf/.pyenv/versions/3.8.5/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/Users/dpf/.pyenv/versions/3.8.5/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

The solution

You should stick to an older version if it is perfectly functional.

If you are not using multiprocessing, you can safely upgrade it.

Spread the love
Categories: Python
Alin Alexandru: Hello! My name is Banuta Alexandru Alin and I am working as a full-time programmer. I have experience in data mining, data science, and data parsing/crawling. I like to travel when I have some days off. May my knowledge help you and protect your way!