This is an automated email from the ASF dual-hosted git repository. zike pushed a commit to branch branch-0.11.0 in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git
commit 59a3227aa86b02088ddd043f4ecf85448722f8aa Author: Jorge Pereira <[email protected]> AuthorDate: Thu Jul 27 12:07:37 2023 +0100 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 <[email protected]> (cherry picked from commit 16a029932d8613a08b542547488e97d321e771a4) --- pulsar/internal/connection.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pulsar/internal/connection.go b/pulsar/internal/connection.go index 1f80d20d..e2ae7ac8 100644 --- a/pulsar/internal/connection.go +++ b/pulsar/internal/connection.go @@ -823,6 +823,11 @@ func (c *connection) handleAuthChallenge(authChallenge *pb.CommandAuthChallenge) return } + // Brokers expect authData to be not nil + if authData == nil { + authData = []byte{} + } + cmdAuthResponse := &pb.CommandAuthResponse{ ProtocolVersion: proto.Int32(PulsarProtocolVersion), ClientVersion: proto.String(ClientVersionString),
