Technoboy- opened a new pull request #14618: URL: https://github.com/apache/pulsar/pull/14618
Cherry-pick https://github.com/apache/pulsar/pull/14367 Master Issue: #14362 ### Motivation See #14362 According to relative PR #7724, we will force delete all subscriptions when calling ``healthCheck`` REST API. but it has a race condition when two threads call this API. Please consider this case: > Thread A: Clean up all subscriptions, then create a reader. > Thread B: Prepare to force delete all subscriptions. So, in this case, the reader of thread A is deleted and then an NPE or other exception occurs. ### Modifications - Use ``Completable#handle`` to fix problem 1, the reader needs to be closed regardless of whether there is an exception. - Recheck the subscription after closing reading, and force deletion if it still exists after closing reading. - Added multi-threaded tests for health checks. ### Verifying this change - [x] Make sure that the change passes the CI checks. ### Documentation - [x] `no-need-doc` -- 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]
