Skip to content

Commit 52dddd9

Browse files
Merge pull request #2952 from devitocodes/jit-cache-race
arch: Fix Compiler.load in multiprocess scenario
2 parents 58df797 + b3a7d6f commit 52dddd9

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

devito/arch/compiler.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,13 @@ def load(self, soname):
297297
obj
298298
The loaded shared object.
299299
"""
300-
return npct.load_library(str(self.get_jit_dir().joinpath(soname)), '.')
300+
try:
301+
return npct.load_library(str(self.get_jit_dir().joinpath(soname)), '.')
302+
except AttributeError as e:
303+
# Some ctypes paths re-wrap dlopen failures, such as a partially
304+
# written .so, as AttributeError. Normalize so jit_compile treats
305+
# the probe as a cache miss and enters codepy's locked compile path.
306+
raise OSError(str(e)) from e
301307

302308
def save_header(self, filename, code):
303309
"""

0 commit comments

Comments
 (0)