Repository navigation
Closed
Labels
type/bugThe PR fixed a bug or issue reported a bug
Description
Search before reporting
- I searched in the issues and found nothing similar.
Read release policy
- 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.
User environment
Broker Version 4.1.0
Broker Java Version 17
Client Library Type: Java
Client Library Version: 4.1.0
Client Java Version: 17
Issue Description
I have the following cluster setup running locally:
- Pulsar Proxy:
1. AuthenticationProviders: AuthenticationKeyStoreTLS, and JWT Authentication.
2. AuthenticationEnabled: true
3. BrokerClientParams: AuthenticationKeyStoreTLS
4. forwardAuthorizationCredentials: true
5. authenticationRefreshCheckSeconds: 5 seconds - Pulsar Broker:
1. AuthenticationProviders: AuthenticationKeyStoreTLS
2. AuthenticationEnabled: true
3. BrokerClientParams: AuthenticationKeyStoreTLS
5. authenticateOriginalAuthData: false - Pulsar Client:
1. Authentication class: JWT
Test case:
- Client connects with a JWT token expiring in the next minute
- Client produces messages at 1 msg/sec
Expected Result:
- Client should produce for the first minute, and then stop with a PulsarClientException when Proxy reauthenticates the token
Observation:
- Proxy runs r-authentication, prints that the token has expired. Prints disconnect message
- Client prints the following messages:
[pulsar-client-io-18-3] WARN org.apache.pulsar.client.impl.ClientCnx - [id: 0x9ed69246, L:/127.0.0.1:62086 - R:localhost/127.0.0.1:62066] Received error from server: Failed to authenticate
[pulsar-client-io-18-3] ERROR org.apache.pulsar.client.impl.ClientCnx - [id: 0x9ed69246, L:/127.0.0.1:62086 - R:localhost/127.0.0.1:62066] Failed to authenticate the client
[pulsar-client-io-18-3] WARN org.apache.pulsar.client.impl.ClientCnx - [id: 0x9ed69246, L:/127.0.0.1:62086 - R:localhost/127.0.0.1:62066] Received unknown request id from server: -1
[pulsar-client-io-18-3] INFO org.apache.pulsar.client.impl.ClientCnx - [id: 0x9ed69246, L:/127.0.0.1:62086 ! R:localhost/127.0.0.1:62066] Disconnected
[pulsar-timer-62-1] INFO org.apache.pulsar.client.impl.ProducerStatsRecorderImpl - [persistent://security-test/security-namespace/security] [test-container-1-0-1] --- Publish throughput: 1.00 msg/s --- 0.00 Mbit/s --- Latency: med: 6.000 ms - 95pct: 20.000 ms - 99pct: 25.000 ms - 99.9pct: 25.000 ms - max: 25.000 ms --- BatchSize: med: 1.000 - 95pct: 1.000 - 99pct: 1.000 - 99.9pct: 1.000 - max: 1.000 --- MsgSize: med: 36.000 bytes - 95pct: 36.000 bytes - 99pct: 36.000 bytes - 99.9pct: 36.000 bytes - max: 36.000 bytes --- Ack received rate: 1.00 ack/s --- Failed messages: 0 --- Pending messages: 0
However, the producer.send and consumer message listener are still able to send and receive messages:
Produced message with ID 2:60:-1
[pulsar-external-listener-33-1] INFO xxxx - Received message with 2:60:-1
[main] INFO xxxx - Produced message with ID 2:61:-1
[main] INFO xxxxx - Produced message with ID 2:62:-1
[pulsar-external-listener-33-1] INFO xxxx - Received message with 2:61:-1
[pulsar-external-listener-33-1] INFO xxxx - Received message with 2:62:-1
Error messages
Reproducing the issue
Run the cluster with the above mentioned configuration, with a docker compose and not pulsar standalone.
Add the same configuration as mentioned above and try to run a producer and consumer with a near-expiry JWT token.
Additional information
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
Metadata
Metadata
Assignees
Labels
type/bugThe PR fixed a bug or issue reported a bug
Activity
lhotari commentedon Dec 12, 2025
This seems to be the problem. #7824 (comment)
lhotari commentedon Dec 12, 2025
The reason for this behavior is that in the case of using Pulsar Proxy, there will be a separate lookup connection to the proxy and separate data connections via the Proxy to brokers. The proxy won't intercept the traffic for data connections after the handshake is complete. That's why it's necessary to enable
authenticateOriginalAuthDataon brokers for token expiration check to work.shasank112001 commentedon Dec 12, 2025
But then I believe we should document this, as authenticateOriginalAuthData is incompatible with mTLS, as proxies can only do reencrypt traffic.
lhotari commentedon Dec 12, 2025
Yes, contributions to improve the documentation are welcome!
Renaming the issue would also be useful since "Client says disconnected but producer and consumer can still produce/consume messages" isn't a bug.
It's likely that the mTLS use case isn't supported currently with token expiration check. We could also close this current issue and have a new one for the real gap.
shasank112001 commentedon Dec 12, 2025
I think creating a new Issue with a feature tag would be best. I will create one and close this issue.