He-Pin opened a new pull request, #3708:
URL: https://github.com/apache/pekko/pull/3708

   ### Motivation
   When `ServerSocketChannel.accept()` throws — most commonly descriptor 
exhaustion (`EMFILE`/`ENFILE`) — `TcpListener` logs at ERROR and immediately 
re-arms `OP_ACCEPT`. The listening channel stays acceptable while the condition 
persists, so the level-triggered selector keeps firing and the listener spins 
in a tight loop emitting one ERROR per iteration. That floods the log (filling 
disk, drowning the diagnostic an operator needs) and keeps the listener actor 
and selector thread hot at exactly the moment resources are scarce.
   
   ### Modification
   - `TcpListener` tracks whether the last accept round hit an error. On error 
it does *not* re-arm `OP_ACCEPT`; instead it schedules a `ChannelAcceptable` 
retry to itself after `pekko.io.tcp.accept-error-retry-delay` (new setting, 
default `100ms`). A successful round re-arms interest as before, so accepting 
resumes automatically once the error clears.
   - The retry cadence also bounds the error log rate to one line per retry 
interval while the condition persists, instead of one per selector-loop 
iteration.
   - The listener still does not stop accepting — this is purely pacing.
   - New `TcpListenerAcceptErrorSpec`: drives a real `TcpListener` with a mock 
`ChannelRegistry`/`ChannelRegistration`, closes the server channel to make 
`accept()` fail persistently, and asserts no `enableInterest(OP_ACCEPT)` 
happens while errors persist.
   
   ### Result
   A persistent accept error no longer pins the selector and floods the log; 
recovery is automatic and the delay is tunable.
   
   ### Tests
   - `sbt "actor-tests / Test / testOnly 
org.apache.pekko.io.TcpListenerAcceptErrorSpec"`: passed
   - Directional check: reverted the fix, re-ran — failed as expected 
(immediate re-arm observed)
   - `sbt "actor-tests / Test / testOnly 
org.apache.pekko.io.TcpIntegrationSpec"`: 15/15 passed
   - Note: `TcpListenerSpec` has 2 failures on my macOS machine that reproduce 
identically on pristine `origin/main` (environmental, unrelated to this change)
   - Full validation on CI
   
   ### References
   Fixes #3692


-- 
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]

Reply via email to