#1071993 cppimport: test_multiple_processes sometimes fails: No such file: 'hook_test.cpython-312-x86_64-linux-gnu.so.lock'

Package:
src:cppimport
Source:
src:cppimport
Submitter:
Drew Parsons
Date:
2024-06-06 17:39:20 UTC
Severity:
normal
Tags:
#1071993#5
Date:
2024-05-27 08:53:42 UTC
From:
To:
cppimport has started failing debci tests on most (if not all)
architectures:

112s ___________________________ test_multiple_processes ____________________________
112s
112s     def test_multiple_processes():
112s         with tmp_dir(["tests/hook_test.cpp"]) as tmp_path:
112s             test_code = f"""
112s     import os;
112s     os.chdir('{tmp_path}');
112s     import cppimport.import_hook;
112s     import hook_test;
112s             """
112s             processes = [
112s                 Process(target=subprocess_check, args=(test_code,)) for i in range(100)
112s             ]
112s
112s             for p in processes:
112s                 p.start()
112s
112s             for p in processes:
112s                 p.join()
112s
112s >           assert all(p.exitcode == 0 for p in processes)
112s E           assert False
112s E            +  where False = all(<generator object test_multiple_processes.<locals>.<genexpr> at 0x7fdfabf48ba0>)
112s
112s tests/test_cppimport.py:236: AssertionError
112s ----------------------------- Captured stdout call -----------------------------
112s Traceback (most recent call last):
112s   File "<string>", line 5, in <module>
112s   File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
112s   File "<frozen importlib._bootstrap>", line 1322, in _find_and_load_unlocked
112s   File "<frozen importlib._bootstrap>", line 1262, in _find_spec
112s   File "/usr/lib/python3/dist-packages/cppimport/import_hook.py", line 21, in find_spec
112s     cppimport.imp(fullname, opt_in=True)
112s   File "/usr/lib/python3/dist-packages/cppimport/__init__.py", line 50, in imp
112s     return imp_from_filepath(filepath, fullname)
112s            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112s   File "/usr/lib/python3/dist-packages/cppimport/__init__.py", line 87, in imp_from_filepath
112s     build_safely(filepath, module_data)
112s   File "/usr/lib/python3/dist-packages/cppimport/importer.py", line 33, in build_safely
112s     with filelock.FileLock(lock_path, timeout=1):
112s   File "/usr/lib/python3/dist-packages/filelock/_api.py", line 339, in __enter__
112s     self.acquire()
112s   File "/usr/lib/python3/dist-packages/filelock/_api.py", line 295, in acquire
112s     self._acquire()
112s   File "/usr/lib/python3/dist-packages/filelock/_unix.py", line 42, in _acquire
112s     fd = os.open(self.lock_file, open_flags, self._context.mode)
112s          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112s FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpe23cj6xk/hook_test.cpython-312-x86_64-linux-gnu.so.lock'


As far as I can tell this is upstream issue #90
https://github.com/tbenthompson/cppimport/issues/90

Not (yet) marking the bug with Severity: Serious since not all systems are effected
(i.e. the test passes on my own local system)

#1071993#12
Date:
2024-05-27 22:12:07 UTC
From:
To:
test_multiple_processes is now skipped in 22.08.02-3 and -4, but
that's just a workaround to avoid having to remove the package.
It shouldn't be considered a solution to the problem.