AlexStocks opened a new pull request, #3564:
URL: https://github.com/apache/dubbo-go/pull/3564
## What
Fixes #3558 — two `time.After` misuses:
### 1. ZooKeeper listener timer leak (P1) — `remoting/zookeeper/listener.go`
The retry loops used `time.After(...)` inside a `select`. When the listener
exits via `l.exit`, the timer was never stopped and lingered (along with its
goroutine) until the delay elapsed — accumulating timers/goroutines under ZK
flapping. Extracted the wait into `ZkEventListener.waitForRetry`, which uses
`time.NewTimer` + `Stop()` on the exit path. This also removes the duplicated
wait block in the two loops.
### 2. AccessLog dead 5s guard (P1) — `filter/accesslog/filter.go`
`drainLogs` had a `default: return` that made the 5s timeout guard a no-op
(it returned on the first iteration whenever the channel was empty), so
blocking log writes were never actually guarded. Removed the `default` and
switched to `time.NewTimer` + `defer Stop()` so the guard now bounds the
drain.
## How to verify
- `go vet ./filter/accesslog/ ./remoting/zookeeper/`
- New unit tests:
- `TestWaitForRetry_*` (exit signaled / timer fires / exit during wait)
- `TestDrainLogs_*` (returns on closed channel, **blocks on empty open
channel as a regression for the dead guard**, drains buffered data)
Both packages build and pass `go test` with Go 1.25.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]