Skip to content

fix(python): add mutex timeout to prevent execute_sync deadlock#1229

Merged
chaliy merged 1 commit intomainfrom
fix/issue-1173-python-deadlock
Apr 12, 2026
Merged

fix(python): add mutex timeout to prevent execute_sync deadlock#1229
chaliy merged 1 commit intomainfrom
fix/issue-1173-python-deadlock

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 11, 2026

Summary

Closes #1173

  • execute_sync() on both Bash and BashTool now uses tokio::time::timeout (30s) on mutex acquisition
  • Prevents indefinite deadlocks when multiple Python threads share one instance
  • Raises RuntimeError with clear guidance to use separate instances for concurrency
  • Thread-safety limitations documented in docstrings

Test plan

  • Compilation verified (cargo check -p bashkit-python)
  • Existing tests pass
  • Timeout triggers RuntimeError instead of indefinite hang

Closes #1173 — execute_sync() now uses tokio::time::timeout (30s) on
the async mutex acquisition. Prevents deadlocks when multiple Python
threads call execute_sync concurrently. Raises RuntimeError with
guidance to use separate instances for concurrent workloads.
@chaliy chaliy force-pushed the fix/issue-1173-python-deadlock branch from 76e4f6f to 31ebdb3 Compare April 11, 2026 23:32
@chaliy chaliy merged commit 66c4f7c into main Apr 12, 2026
18 checks passed
@chaliy chaliy deleted the fix/issue-1173-python-deadlock branch April 12, 2026 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sec(python): execute_sync blocks tokio runtime — concurrent Python callers can deadlock

1 participant