[Bug] Worker intermittently stops polling after synchronous activity completion
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- distributed-systems
Research direction
Start by reproducing the configured Worker with a ThreadPoolExecutor and long-running synchronous activity, then trace polling immediately after the CompleteActivity RPC succeeds. Done means the worker continues issuing poll requests after completion without waiting 5–15 minutes for reconnection.
Written by the indexing model from the issue text.
Description
Summary
Worker intermittently stops polling after completing long-running synchronous activities. The gRPC connection appears to drop after activity completion, but the worker process remains
alive. Auto-reconnection eventually works (5-15 minutes later), but causes delays in activity processing.
Environment
- temporalio version: 1.18.1
- grpcio version: 1.75.1
- Python version: 3.11
- Temporal Server: Running in Docker (localhost:7233)
- OS: Ubuntu Linux
Worker Configuration
with concurrent.futures.ThreadPoolExecutor(max_workers=60) as executor:
worker = Worker(
client,
task_queue="core-py",
max_concurrent_activities=60,
activities=[...],
workflows=[],
activity_executor=executor,
graceful_shutdown_timeout=timedelta(seconds=300),
)
await worker.run()
Activity Characteristics
- Type: Synchronous (runs on ThreadPoolExecutor)
- Duration: 30 minutes to 3 hours
- Timeout: 36,000 seconds (10 hours)
- Heartbeat: Disabled (0s)
Observed Behavior
┌──────┬───────────────────────────────────────────────────┐
│ Step │ What Happens │
├──────┼───────────────────────────────────────────────────┤
│ 1 │ Worker polls, receives activity │
├──────┼───────────────────────────────────────────────────┤
│ 2 │ Activity executes (30 min - 3 hrs) │
├──────┼───────────────────────────────────────────────────┤
│ 3 │ Activity completes, CompleteActivity RPC succeeds │
├──────┼───────────────────────────────────────────────────┤
│ 4 │ Worker stops polling - no new poll requests │
├──────┼───────────────────────────────────────────────────┤
│ 5 │ Server logs "task queue closed" after 5 min │
├──────┼───────────────────────────────────────────────────┤
│ 6 │ Worker auto-reconnects after 5-15 min │
└──────┴───────────────────────────────────────────────────┘
Evidence
Queue closes exactly 5 min after activity completion:
┌────────────────────┬──────────────┐
│ Activity Completed │ Queue Closed │
├────────────────────┼──────────────┤
│ 08:02:39 │ 08:07:39 │
├────────────────────┼──────────────┤
│ 08:57:38 │ 09:02:38 │
├────────────────────┼──────────────┤
│ 09:46:46 │ 09:51:46 │
└────────────────────┴──────────────┘
During stuck period:
- Process alive, 45 threads active
- DB connections work
- No TCP connection to port 7233
Key Observations
1. Intermittent - not every completion triggers it
2. No duration correlation - 27 min to 168 min activities affected
3. Auto-recovery works - just slow (5-15 min)
4. Completion succeeds - only polling stops afterward
Suspected Cause
Race condition in SDK's handling of synchronous activity completion. After ThreadPoolExecutor returns result and CompleteActivity RPC succeeds, polling doesn't resume properly.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 241
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 49
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from temporalio/sdk-python
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
temporalio/sdk-python#1517 · 10 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
temporalio/sdk-python#496 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
temporalio/sdk-python#1894 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
temporalio/sdk-python#1890 ·
-
[Bug] Local activity resolutions regrouped on replay since 1.32.0, delivering the wrong payload Open
Difficulty 4/5 3-5 days Newbie friendliness 52/100
temporalio/sdk-python#1881 · 1 comment ·
All issues in temporalio/sdk-python
Similar issues
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
open-webui/open-webui#30750 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 90/100