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

   
   ### Motivation
   While normally `inFlightTasks` contains at most one pending read task 
(guaranteed by `hasPendingRead()` in `acquirePermitsIfNotFetchingSchema()`), in 
exceptional scenarios, multiple tasks with `entries == null` may occur.
   
   The original implementation only set `entries` for the last pending task 
iterated over; the `entries` of the preceding pending tasks remained null. If 
`canceledPendingRead` = true (i.e., the cursor's read has been canceled, and 
the callback will not occur again), these unset tasks will remain in a pending 
state indefinitely, causing:
   `hasPendingRead()` to always return true, 
`acquirePermitsIfNotFetchingSchema()` to always return null, and copying to be 
permanently stuck.
   
   The improved implementation sets `entries = emptyList()` for all pending 
tasks when `canceledPendingRead` = true. This ensures that all canceled tasks 
complete correctly, and no task will remain in a pending state indefinitely.
   
   
   ### 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
   
   ### 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
   


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