spuru9 opened a new pull request, #29660:
URL: https://github.com/apache/flink/pull/29660

   ## What is the purpose of the change
   
   Fixes the flaky `AbstractServerTest.testPortRangeSuccess`. With a quiet 
period of 0, Netty 4.2 can terminate an event loop without closing its channels 
if the shutdown starts while the loop runs tasks 
([netty/netty#17897](https://github.com/netty/netty/issues/17897), fix pending 
in [netty/netty#18035](https://github.com/netty/netty/pull/18035)). 
`AbstractServerBase` therefore leaked its listening socket and accepted 
connections on shutdown.
   
   ## Brief change log
   
   - `AbstractServerBase` tracks the server channel and accepted channels in a 
`ChannelGroup` and closes them before `shutdownGracefully(0, 0)`. The group 
stays closed, so a connection that is accepted during the shutdown is closed 
too.
   - TODO in code to drop the explicit close once the Netty fix is available 
through flink-shaded.
   
   ## Verifying this change
   
   - Added `AbstractServerTest#testShutdownClosesChannelsWhileEventLoopIsBusy`, 
which shuts the server down while its event loop runs a task. It fails without 
the fix and passes with it.
   - Ran `testPortRangeSuccess` 20,000× with all CPUs busy: 3 failures and a 
creeping port range (leaked listening sockets) before the fix, 0 failures and 
stable ports after it.
   - All `flink-queryable-state` tests pass on JDK 17 and JDK 21.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Claude Opus 5.5)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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

Reply via email to