Skip to content

Commit 1328148

Browse files
committed
Don't interrupt thread from Rust
1 parent ecd1fd7 commit 1328148

File tree

2 files changed

+1
-32
lines changed

2 files changed

+1
-32
lines changed

temporalio/worker/_workflow.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,7 @@ def attempt_deadlock_interruption(self) -> None:
667667
return
668668
deadlocked_thread_id = self.instance.get_thread_id()
669669
if deadlocked_thread_id:
670-
temporalio.bridge.runtime.Runtime._raise_in_thread(
671-
deadlocked_thread_id, _InterruptDeadlockError
672-
)
670+
pass
673671

674672

675673
class _InterruptDeadlockError(BaseException):

tests/worker/test_workflow.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6994,35 +6994,6 @@ async def run(self) -> None:
69946994
deadlock_interruptible_completed += 1
69956995

69966996

6997-
async def test_workflow_deadlock_interruptible(client: Client):
6998-
# TODO(cretz): Improve this test and other deadlock/eviction tests by
6999-
# checking slot counts with Core. There are a couple of bugs where used slot
7000-
# counts are off by one and slots are released before eviction (see
7001-
# https://github.com/temporalio/sdk-core/issues/894).
7002-
7003-
# This worker used to not be able to shutdown because we hung evictions on
7004-
# deadlock
7005-
async with new_worker(client, DeadlockInterruptibleWorkflow) as worker:
7006-
# Start the workflow
7007-
assert deadlock_interruptible_completed == 0
7008-
handle = await client.start_workflow(
7009-
DeadlockInterruptibleWorkflow.run,
7010-
id=f"workflow-{uuid.uuid4()}",
7011-
task_queue=worker.task_queue,
7012-
)
7013-
# Wait for task fail
7014-
await assert_task_fail_eventually(handle, message_contains="deadlock")
7015-
7016-
# Confirm workflow was interrupted
7017-
async def check_completed():
7018-
assert deadlock_interruptible_completed >= 1
7019-
7020-
await assert_eventually(check_completed)
7021-
completed_sec = time.monotonic()
7022-
# Confirm worker shutdown didn't hang
7023-
assert time.monotonic() - completed_sec < 20
7024-
7025-
70266997
deadlock_uninterruptible_event = threading.Event()
70276998
deadlock_uninterruptible_completed = 0
70286999

0 commit comments

Comments
 (0)