You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "lhotari (via GitHub)" <gi...@apache.org> on 2025/01/18 01:33:52 UTC

[I] [Bug] Subscribing to topic executes work on the single threaded Pulsar metadata thread in some cases [pulsar]

lhotari opened a new issue, #23866:
URL: https://github.com/apache/pulsar/issues/23866

   ### Search before asking
   
   - [x] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
   
   
   ### Read release policy
   
   - [x] I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
   
   
   ### Version
   
   All released versions
   
   ### Minimal reproduce step
   
   Subscribe to a topic when metadata isn't yet cached.
   
   ### What did you expect to see?
   
   The topic ordered executor to be used.
   
   ### What did you see instead?
   
   configuration-metadata-store executor was used:
   ![Image](https://github.com/user-attachments/assets/600079dc-274b-4d23-808e-98dd90364e34)
   It's this executor: https://github.com/apache/pulsar/blob/80157955b69d97fa0568fad4127e34e30e9a2b85/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java#L93-L95
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
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: commits-unsubscribe@pulsar.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] Subscribing to topic executes work on the single threaded Pulsar metadata thread in some cases [pulsar]

Posted by "merlimat (via GitHub)" <gi...@apache.org>.
merlimat commented on issue #23866:
URL: https://github.com/apache/pulsar/issues/23866#issuecomment-6380955576

   Confirmed on current master. In `ServerCnx.handleSubscribe` (pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:2383 on master), `topic.subscribe(option)` is chained with `thenCompose` onto `BrokerService.isAllowAutoSubscriptionCreationAsync()` (BrokerService.java:4903), which reads the namespace policies through `getPoliciesAsync`. On a cache miss that future completes on the configuration-metadata-store thread, so the subscribe and everything after it run on the single metadata thread. The likely fix is to switch to `thenComposeAsync` on the topic's ordered executor (or `ctx.executor()`) before calling `topic.subscribe`. ServerCnx.java:2837 (the producer's initial subscription) has the same pattern.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org