Closed Gsantomaggio closed 1 year ago
Patch coverage: 78.78
% and project coverage change: -0.35
:warning:
Comparison is base (
4e22a3d
) 80.22% compared to head (d4870eb
) 79.87%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@flykos PR is ready to test. Please let us know!
When I tried to use the 1.2.0 Stream client to access RabbitMQ through a certificate, I found an exception. the client report:
Unexpected error:
<*errors.errorString | 0xc00054e090>:
timeout 10000 ms - waiting Code, operation: commandSaslAuthenticate
{
s: "timeout 10000 ms - waiting Code, operation: commandSaslAuthenticate ",
}
occurred
My client code is as follows:
streamTlscfg := new(tls.Config)
streamTlscfg.ServerName = "localhost"
streamTlscfg.RootCAs = x509.NewCertPool()
if ca, err := os.ReadFile("/tmp/testca/cacert.pem"); err == nil {
streamTlscfg.RootCAs.AppendCertsFromPEM(ca)
}
if cert, err := tls.LoadX509KeyPair("/tmp/client_gpadmin/cert.pem", "/tmp/client_gpadmin/key.pem"); err == nil {
streamTlscfg.Certificates = append(streamTlscfg.Certificates, cert)
}
tlsEnv, tlsErr := stream.NewEnvironment(stream.NewEnvironmentOptions().
SetUri("rabbitmq-stream+tls://localhost:5551/vhost_gpss").
IsTLS(true).
SetSaslConfiguration(stream.SaslConfigurationExternal).
SetTLSConfig(streamTlscfg))
Expect(tlsErr).ShouldNot(HaveOccurred())
streamTlsEnvironment = tlsEnv
The error log in server side is as follows:
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> ** Stacktrace =
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> ** [{rabbit_auth_mechanism_ssl,handle_response,
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> [<<0,0>>,peer_properties_exchanged],
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> [{file,"rabbit_auth_mechanism_ssl.erl"},
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> {line,64}]},
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> {rabbit_stream_reader,handle_frame_pre_auth,4,
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> [{file,"rabbit_stream_reader.erl"},{line,1233}]},
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> {lists,foldl,3,[{file,"lists.erl"},{line,1267}]},
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> {rabbit_stream_reader,handle_info,3,
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> [{file,"rabbit_stream_reader.erl"},{line,472}]},
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> {gen_statem,loop_state_callback,11,[{file,"gen_statem.erl"},{line,1203}]},
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0> ** Time-outs: {1,[{state_timeout,close}]}
2024-01-10 03:11:23.873532-05:00 [error] <0.9672.0>
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> crasher:
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> initial call: rabbit_stream_reader:init/1
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> pid: <0.9672.0>
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> registered_name: []
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> exception error: no function clause matching
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> rabbit_auth_mechanism_ssl:handle_response(<<0,0>>,
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> peer_properties_exchanged) (rabbit_auth_mechanism_ssl.erl, line 64)
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> in function rabbit_stream_reader:handle_frame_pre_auth/4 (rabbit_stream_reader.erl, line 1233)
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> in call from lists:foldl/3 (lists.erl, line 1267)
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> in call from rabbit_stream_reader:handle_info/3 (rabbit_stream_reader.erl, line 472)
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> in call from gen_statem:loop_state_callback/11 (gen_statem.erl, line 1203)
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> ancestors: [<0.9670.0>,<0.689.0>,<0.688.0>,<0.687.0>,<0.685.0>,
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> <0.684.0>,rabbit_stream_sup,<0.662.0>]
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> message_queue_len: 0
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> messages: []
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> links: [<0.9670.0>]
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> dictionary: []
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> trap_exit: true
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> status: running
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> heap_size: 17731
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> stack_size: 28
2024-01-10 03:11:23.874561-05:00 [error] <0.9672.0> reductions: 56476
Fixes https://github.com/rabbitmq/rabbitmq-stream-go-client/issues/207
How to test with the new setting
SetSaslConfiguration(stream.SaslConfigurationExternal)
Docker image: