[Bug] Two-way geo replication doesn't support exclusive access producers
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before reporting
- [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](https://pulsar.apache.org/contribute/release-policy/#supported-versions) don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
### User environment
Apache pulsar 4.0.6, broker running on the same Ubuntu22 box. 2 clusters geo replicated .
### Issue Description
When enabling 2-way geo replication on a pulsar cluster (clusterA) to replicate messages to a second cluster (clusterB) and clusterA has at least one topic accessed in exclusive mode by one producer, the second cluster (clusterB) doesn't replicate the messages to the first cluster (clusterA) and throws an error saying there is alredy a topic with exclusive access: the internal producer in charge of geo replication, clashes with the client app producer that has exclusive access.
### Error messages
```text
`pulsar-broker-ip-10-166-67-29.log:2025-10-28T17:41:00,261+0000 [pulsar-io-3-4] ERROR org.apache.pulsar.client.impl.ProducerImpl - [persistent://tn2/ns2/tpc2] [pulsar.repl.pulgeo2-->pulgeo1] Failed to create producer: {"errorMsg":"org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic has an existing exclusive producer: pulgeo1-14-45","reqId":4267594562146349661, "remote":"ip-10-166-70-175.us-west-2.compute.internal/10.166.70.175:6650", "local":"/10.166.67.29:40330"}
pulsar-broker-ip-10-166-67-29.log:2025-10-28T17:41:00,261+0000 [pulsar-io-3-4] WARN org.apache.pulsar.broker.service.AbstractReplicator - [persistent://tn2/ns2/tpc2 | pulgeo2-->pulgeo1] Failed to create remote producer (org.apache.pulsar.client.api.PulsarClientException$ProducerBusyException: {"errorMsg":"org.apache.pulsar.broker.service.BrokerServiceException$ProducerBusyException: Topic has an existing exclusive producer: pulgeo1-14-45","reqId":4267594562146349661, "remote":"ip-10-166-70-175.us-west-2.compute.internal/10.166.70.175:6650", "local":"/10.166.67.29:40330"}), retrying in 24.743 s`
```
### Reproducing the issue
this can be reproduced easily following the steps below:
- on clusterA: create a topic and start a producer application that accesses the topic in Exclusive or ExclusiveWithFencing mode: ".accessMode(ProducerAccessMode.Exclusive)"
- on clusterA: configure the namespace to be geo replicated to clusterB: "pa namespaces set-clusters --clusters=clusterA,clusterB"
- on clusterB: create the replicated namespace but don't establish the 2-way replication: "pa namespaces create --clusters=clusterB"
- on clusterB: verify that the messages produced by the exclusive producer are replicated to clusterB
- on clusterB: enable 2-way replication: "pa namespaces set-clusters --clusters=clusterA,clusterB" and verify that the error message is thrown in the broker logs.
- on clusterB: also verify that the topics stats show "connected=false" in the replication block.
### Additional information
The expected behaviour is that geo replication allows the use of exclusive producers on the replicated topics. But the mechanics of geo replication involves the creation of internal producers that take care of geo replicating messages. These internal producers conflict with the exclusive producers of client application.
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
Research direction
Start by reproducing the two-way geo-replication setup with an exclusive producer, using the namespace commands and checking the broker logs and replication topic stats. Read the AbstractReplicator and ProducerImpl paths referenced by the errors, then trace internal producer creation and exclusive-access handling. Done means replicated topics remain connected and messages flow in both directions without ProducerBusyException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100