ethereum-optimism / optimistic-specs

Optimistic: Bedrock, is a protocol that strives to be an extremely simple optimistic rollup that maintains 1:1 compatibility with Ethereum
MIT License
168 stars 36 forks source link

Use ticker instead of time.After in select loop #449

Closed trianglesphere closed 2 years ago

trianglesphere commented 2 years ago

Description

Repeatedly using time.After in a select loop leaks resources as resources are allocated for each timer, but not released until the timer fires. The timer may not fire due to other return paths. By using tickers, this resource leak is no longer able to happen.

I verified that this problem no longer exists with the following semgrep command. semgrep --config="r/dgryski.semgrep-go.timeafter.leaky-time-after"

Metadata

trianglesphere commented 2 years ago

closing to move to monorepo