apache / apache/pulsar

[bug][java-client] Client creation fails with enableTransactions=true if topic transaction_coordinator_assign has not been created yet

Open
#15,996 1 comment 0 reactions 0 assignees View on GitHub
area/transaction Stale type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

**Describe the bug**
Client creation fails with enableTransactions=true if topic transaction_coordinator_assign has not been created yet

```
Caused by: org.apache.pulsar.client.api.transaction.TransactionCoordinatorClientException: org.apache.pulsar.client.api.PulsarClientException$BrokerMetadataException: {"errorMsg":"Namespace not found","reqId":3642126209754600375, "remote":"localhost/127.0.0.1:54629", "local":"/127.0.0.1:54823"}
at app//org.apache.pulsar.client.api.transaction.TransactionCoordinatorClientException.unwrap(TransactionCoordinatorClientException.java:131)
at app//org.apache.pulsar.client.api.transaction.TransactionCoordinatorClientException.unwrap(TransactionCoordinatorClientException.java:129)
at app//org.apache.pulsar.client.impl.transaction.TransactionCoordinatorClientImpl.start(TransactionCoordinatorClientImpl.java:70)
at app//org.apache.pulsar.client.impl.PulsarClientImpl.(PulsarClientImpl.java:204)
... 47 more
```

I found this while enabling transactions on Pulsar standalone but it could apply also in a real cluster.

**To Reproduce**
- Start Pulsar standalone with transactions enabled (see [this pull](https://github.com/testcontainers/testcontainers-java/pull/5479) for reference
- Create a client suddenly after Pulsar is ready (but the topic doesn't exist yet)

**Expected behavior**
The client should work out of the box without throwing exceptions.
Perhaps an infinite backoff retry with severe logging could be a good solution.

**Additional context**
All the Pulsar versions

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with standalone transactions enabled and a client created before transaction_coordinator_assign exists. Start at TransactionCoordinatorClientImpl.start and the PulsarClientImpl constructor shown in the stack trace; the client should start successfully while the topic is still absent, with the eventual retry behavior and logging defined by the implementation.

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.