Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions tensorrt_llm/_torch/model_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import contextlib
import errno
import json
import os
import tempfile
Expand Down Expand Up @@ -86,8 +87,14 @@ def config_file_lock(timeout: int = 10):
try:
with lock:
yield
except (PermissionError, filelock.Timeout):
# Fallback to tempdir
except (PermissionError, OSError, filelock.Timeout) as e:
# Fallback to tempdir when primary lock path is unusable (e.g.,
# NFS locking failures like ENOLCK/ESTALE, permission issues,
# or lock acquisition timeouts)
if isinstance(e,
OSError) and e.errno not in (errno.EACCES, errno.EPERM,
errno.ENOLCK, errno.ESTALE):
raise
tmp_dir = Path(tempfile.gettempdir())
tmp_dir.mkdir(parents=True, exist_ok=True)
tmp_lock_path = tmp_dir / "_remote_code.lock"
Expand All @@ -101,7 +108,11 @@ def config_file_lock(timeout: int = 10):
)
# proceed without lock
yield
except (PermissionError) as e:
except (PermissionError, OSError) as e:
if isinstance(
e, OSError) and e.errno not in (errno.EACCES, errno.EPERM,
errno.ENOLCK, errno.ESTALE):
raise
logger.warning(
f"tempdir config lock unavailable due to OS/permission issue: {e}, proceeding without lock"
)
Expand Down
Loading