Skip to content

Python 3.9: AttributeError: Can't pickle local object 'TestSuite.__init__.<locals>.<lambda>' #265

Closed
@ligurio

Description

@ligurio
Traceback (most recent call last):
  File "/Users/tntmac01.tarantool.i/tarantool/build/test/../../test/test-run.py", line 235, in <module>
    status = main_parallel()
  File "/Users/tntmac01.tarantool.i/tarantool/build/test/../../test/test-run.py", line 150, in main_parallel
    res = main_loop_parallel()
  File "/Users/tntmac01.tarantool.i/tarantool/build/test/../../test/test-run.py", line 109, in main_loop_parallel
    dispatcher.start()
  File "/Users/tntmac01.tarantool.i/tarantool/test-run/dispatcher.py", line 165, in start
    self.run_max_workers()
  File "/Users/tntmac01.tarantool.i/tarantool/test-run/dispatcher.py", line 161, in run_max_workers
    ok = self.add_worker()
  File "/Users/tntmac01.tarantool.i/tarantool/test-run/dispatcher.py", line 214, in add_worker
    process = task_queue_disp.add_worker(self.worker_next_id,
  File "/Users/tntmac01.tarantool.i/tarantool/test-run/dispatcher.py", line 409, in add_worker
    process.start()
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch
    reduction.dump(process_obj, fp)
  File "/usr/local/Cellar/python@3.9/3.9.1_6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'TestSuite.__init__.<locals>.<lambda>'

Python 3.9 is default python3 interpreter on Mac OS.

Preliminary investigation:

spawn mode in multiprocessing module became default on mac https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods. One can force fork mode in multiprocessing module on mac but it may work unstable, see https://bugs.python.org/issue33725

To workaround it can be possible to force fork mode with multiprocessing.set_start_method('fork'), but Tarantool process start sometime failed before running tests.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions