Repository navigation
fix(synology-chat,twitch,zalouser): clear timeout timers in Promise.race patterns - #39745
Bortlesboat wants to merge 1 commit into
Conversation
…ace patterns Several extensions use Promise.race with setTimeout-based timeouts but never clear the timer when the main promise wins the race: - synology-chat webhook-handler: 120s agent response timeout rejects after nobody is listening, causing an unhandled promise rejection - twitch probe: connection timeout rejects after successful connect - zalouser probe: timeout timer keeps running after user info resolves Store timer handles and clear them in finally blocks so timers are always cleaned up regardless of which side wins the race. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Greptile SummaryThis PR fixes a recurring resource-leak pattern across three extensions where Changes per file:
All three fixes are correct — Confidence Score: 5/5
Last reviewed commit: cf4d265 |
|
This looks good. The cleanup timer approach is cleaner than removing the timeout entirely, and covering all 3 extensions in one PR makes sense. |
|
Thanks for the review @druide67 — glad the cleanup timer approach reads well. Is this ready to merge from the maintainer side, or is there anything else needed before it lands? |
|
Trimmed my open PR queue from 10 → 7 to make review easier. This one has green CI across all checks and a positive review from @druide67 — happy to address any remaining feedback if needed. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open. This PR still has useful timer-cleanup work for Zalouser and possibly Synology Chat, but it is not merge-ready because current main already has the Twitch cleanup, the branch is conflicting, real behavior proof is missing, and the Synology hunk overlaps the open configured-timeout issue at #59966. Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review. Do we have a high-confidence way to reproduce the issue? Yes, by source inspection rather than a live run. Current main still leaves Synology Chat and Zalouser timeout timers unretained and uncleared when the main operation wins, while Twitch already clears its timeout handle. Is this the best way to solve the issue? No, not in the current branch form. The cleanup pattern is useful, but the PR should be rebased, drop the obsolete Twitch hunk, and coordinate the Synology hunk with the configured-timeout bug before merge. Security review: Security review cleared: The diff only changes bundled plugin TypeScript timer cleanup and does not modify dependencies, workflows, scripts, secrets, permissions, generated files, or package metadata. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a4a1abbe3097. |
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Several extensions use
Promise.racewithsetTimeout-based timeouts but never clear the timer when the main promise wins the race. When the winning promise resolves/rejects first, the losingsetTimeoutfires later — either rejecting an unlistened promise (causingunhandledRejection) or keeping a timer handle alive unnecessarily.Affected extensions:
webhook-handler.ts: 120s agent response timeout rejects after nobody is listeningprobe.ts: connection timeout rejects after successful connectprobe.ts: timeout timer keeps running after user info resolvesThis is the same class of bug fixed in the Nostr extension (#39742) — systematic audit found these additional instances.
Changes
Store timer handles and clear them in
finallyblocks so timers are always cleaned up regardless of which side wins the race.Test plan
npx vitest run extensions/synology-chat/— all tests passnpx vitest run extensions/twitch/— all tests passnpx vitest run extensions/zalouser/— all tests pass