Skip to content

Fix timer leak in PauseController#192

Open
AnyCPU wants to merge 1 commit intobasecamp:mainfrom
AnyCPU:fix/pause_ctrl_timer_leak_1
Open

Fix timer leak in PauseController#192
AnyCPU wants to merge 1 commit intobasecamp:mainfrom
AnyCPU:fix/pause_ctrl_timer_leak_1

Conversation

@AnyCPU
Copy link
Contributor

@AnyCPU AnyCPU commented Feb 15, 2026

PauseController.getWaitState() uses time.After() to create a timeout channel for paused requests.

Per the Go documentation, the underlying time.Timer created by time.After is not garbage collected until it fires.

When a paused service resumes (or is stopped) before the FailAfter duration expires, the timer becomes orphaned — still held by the Go runtime but serving no purpose.

Under high request volume with a long FailAfter duration, each incoming request allocates a new orphaned timer, causing unbounded memory growth proportional to request_rate × FailAfter_duration.

Fix

Replace time.After with time.NewTimer, which returns a *time.Timer that can be explicitly stopped.

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.

1 participant