style(workflow): dedupe unexpected timerFired warnings (fixes upstream #980)#1
Open
Aydeing wants to merge 1 commit into
Open
style(workflow): dedupe unexpected timerFired warnings (fixes upstream #980)#1Aydeing wants to merge 1 commit into
Aydeing wants to merge 1 commit into
Conversation
Repeated timerFired events with no matching pending task could flood logs with thousands of identical warnings per workflow request (see dapr#980), because the same unexpected event was re-emitted across activity retries. Track each (instance_id, timer_id) pair seen by _OrchestrationExecutor in a bounded LRU and emit the warning only on first occurrence. Capacity is capped at 1024 entries so memory cannot grow without bound. Fixes dapr#980 Signed-off-by: Aydeing <ayush.modi700@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Targets upstream issue dapr/python-sdk#980.
A misbehaving runtime can replay the same unexpected
timerFiredevent many times across activity retries, producing 1000+ identical warning lines for a single workflow request. Fix dedupes the warning per(instance_id, timer_id)pair using a bounded LRU cache on_OrchestrationExecutor.Changes
dapr/ext/workflow/_durabletask/worker.py_UNEXPECTED_TIMER_WARN_CAPACITY = 1024module constant._warned_unexpected_timers: OrderedDict[tuple[str, int], None]on_OrchestrationExecutor.__init__._warn_unexpected_timer_once(instance_id, timer_id)helper that emits the warning at most once per pair, evicting the oldest entry when capacity is exceeded.timerFiredbranch ofprocess_eventwith the helper.tests/ext/workflow/durabletask/test_orchestration_executor.py— 4 new tests:monkeypatchon_UNEXPECTED_TIMER_WARN_CAPACITY)process_eventwith 100 repeatedtimerFiredevents emits a single warningValidation
uv run ruff check— cleanuv run ruff format— cleanuv run mypy—Success: no issues found in 175 source filesuv run pytest -m "not e2e" ./tests/ext/workflow/—391 passed, 33 deselectedSafety / scope notes
timerFiredwarning (matches issue titlestyle: limit durabletask warnings for timers). Identical patterns exist fortaskCompleted,taskFailed,childWorkflowInstanceCompleted, andchildWorkflowInstanceFailed— they can be refactored to the same helper in a follow-up.