gaozhangmin opened a new pull request, #25111:
URL: https://github.com/apache/pulsar/pull/25111

    ### Motivation
   
     During the shutdown process of Pulsar brokers, protocol handlers' channels 
are not properly closed, which allows new client requests to continue arriving 
even after the shutdown has been initiated. This can lead to:
   
     - Resource leaks as channels remain open during shutdown
     - Unexpected behavior where clients can still send requests to a 
shutting-down broker
     - Inconsistent shutdown behavior compared to the main broker channel 
management
   
     The broker's `closeAsync` method properly handles closing all channels by 
calling `channel.close()` on all channels in `listChannels`. However, the same 
pattern is not applied to protocol handlers, leaving their channels open during 
the shutdown process.
   
     ### Modifications
   
     - Added `closeProtocolHandlerChannels()` method to properly close all 
protocol handler channels before calling `protocolHandler.close()`
     - Modified the broker shutdown sequence to ensure protocol handler 
channels are closed before the protocol handler itself is closed
     - This ensures no new client connections can be established to protocol 
handlers during the shutdown process
     - Follows the same pattern as the existing broker channel closing 
mechanism in `closeAsync`
   
     ### Verifying this change
   
     - [ ] Make sure that the change passes the CI checks.
   
     This change is already covered by existing tests, such as:
     - Existing broker shutdown tests will verify the proper shutdown sequence
     - Protocol handler lifecycle tests will ensure channels are properly closed
     - Connection management tests will verify no new connections are accepted 
during shutdown
   
     ### Does this pull request potentially affect one of the following parts:
   
     <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
     *If the box was checked, please highlight the changes*
   
     - [ ] Dependencies (add or upgrade a dependency)
     - [ ] The public API
     - [ ] The schema
     - [ ] The default values of configurations
     - [ ] The threading model
     - [ ] The binary protocol
     - [ ] The REST endpoints
     - [ ] The admin CLI options
     - [ ] The metrics
     - [ ] Anything that affects deployment - *Changes broker shutdown behavior 
which affects deployment lifecycle*
   
     ### Documentation
   
     <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
     - [ ] `doc` <!-- Your PR contains doc changes. -->
     - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
     - [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
     - [ ] `doc-complete` <!-- Docs have been already added -->
   
     ### Matching PR in forked repository
   
     PR in forked repository: <!-- ENTER URL HERE -->
   
     <!--
     After opening this PR, the build in apache/pulsar will fail and 
instructions will
     be provided for opening a PR in the PR author's forked repository.
   
     apache/pulsar pull requests should be first tested in your own fork since 
the
     apache/pulsar CI based on GitHub Actions has constrained resources and 
quota.
     GitHub Actions provides separate quota for pull requests that are executed 
in
     a forked repository.
   
     The tests will be run in the forked repository until all PR review 
comments have
     been handled, the tests pass and the PR is approved by a reviewer.
     -->


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