-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(serverless/appsec): goroutine leak in TokenTicker tests
The tests for `TokenTicker` rely on a chanel to synchronize with token bucket updates (each update sends one message to that channel). There was an issue when closing those test tickers, where it is possible the ticker goroutine may process the closing of the ticker channel before the stop signal; leading to one last message being sent to the synchronization channel. This resulted in the bucket updater goroutine blocking on the channel send indefinitely, as this last send was not paired with a receive on the other side. This could result in those tests leaking a modest amount of goroutines, affecting the goroutine scheduler's performance. When running tests with `-count`, this could reliably cause tests to time out, once enough leaked goroutines have accumulated that the scheduler wastes most of its time on these.
- Loading branch information
1 parent
2537525
commit 58736bf
Showing
3 changed files
with
38 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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