Skip to content

Commit 59a3227

Browse files
jffp113RobertIndie
authored andcommitted
Fix: client reconnected every authenticationRefreshCheckSeconds when using tls authentication (#1062)
### Motivation When using pulsar tls authentication with a broker that sets the authenticationRefreshCheckSeconds the connection was dropped for each authentication refresh check. After analyzing logs and tcpdumps I concluded that this error appears because the tls authentication is returning null, witch does not pass a validation in the broker. After analyzing the tls auth implementation in Java (that works), I concluded that the GetData method should return empty byte array instead of nil. ### Modifications Changed tls auth GetData to return empty byte array instead of nil. --------- Co-authored-by: Jorge Pereira <jorge.pereira@cross-join.com> (cherry picked from commit 16a0299)
1 parent a6b15dc commit 59a3227

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pulsar/internal/connection.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -823,6 +823,11 @@ func (c *connection) handleAuthChallenge(authChallenge *pb.CommandAuthChallenge)
823823
return
824824
}
825825

826+
// Brokers expect authData to be not nil
827+
if authData == nil {
828+
authData = []byte{}
829+
}
830+
826831
cmdAuthResponse := &pb.CommandAuthResponse{
827832
ProtocolVersion: proto.Int32(PulsarProtocolVersion),
828833
ClientVersion: proto.String(ClientVersionString),

0 commit comments

Comments
 (0)