BewareMyPower opened a new issue, #398: URL: https://github.com/apache/pulsar-client-cpp/issues/398
### Search before asking - [X] I searched in the [issues](https://github.com/apache/pulsar-client-cpp/issues) and found nothing similar. ### Version main branch ### Minimal reproduce step Apply the following diff: ```diff diff --git a/lib/ClientConnection.cc b/lib/ClientConnection.cc index 844d58f..4b11fba 100644 --- a/lib/ClientConnection.cc +++ b/lib/ClientConnection.cc @@ -388,6 +388,13 @@ typedef ASIO::detail::socket_option::integer<IPPROTO_TCP, TCP_KEEPIDLE> tcp_keep * at this point the connection is deemed valid to be used by clients of this class */ void ClientConnection::handleTcpConnected(const ASIO_ERROR& err, tcp::resolver::iterator endpointIterator) { + auto weakSelf = weak_from_this(); + executor_->postWork([this, weakSelf] { + auto self = weakSelf.lock(); + if (self) { + close(ResultDisconnected); + } + }); if (!err) { std::stringstream cnxStringStream; try { ``` Then run the `AuthPluginTest.testTlsDetectPulsarSsl` test. ### What did you expect to see? At least the test should not crash ### What did you see instead? ``` 2024-02-06 17:16:24.187 INFO [0x1fc1da100] ClientConnection:187 | [<none> -> pulsar+ssl://localhost:6651] Create ClientConnection, timeout=10000 2024-02-06 17:16:24.190 INFO [0x1fc1da100] ConnectionPool:119 | Created connection for pulsar+ssl://localhost:6651-0 2024-02-06 17:16:24.191 INFO [0x16efa7000] ClientConnection:410 | [[::1]:63587 -> [::1]:6651] Connected to broker 2024-02-06 17:16:24.191 INFO [0x16efa7000] ClientConnection:1313 | [[::1]:63587 -> [::1]:6651] Connection disconnected (refCnt: 2) 2024-02-06 17:16:24.191 INFO [0x16efa7000] ConnectionPool:134 | Remove connection for pulsar+ssl://localhost:6651-0 2024-02-06 17:16:24.191 INFO [0x16efa7000] RetryableOperation:114 | Reschedule get-partition-metadata-persistent://private/auth/test-tls-detect for 100 ms, remaining time: 29900 ms 2024-02-06 17:16:24.191 INFO [0x16efa7000] ClientConnection:275 | [[::1]:63587 -> [::1]:6651] Destroyed connection to pulsar+ssl://localhost:6651-0 zsh: segmentation fault ./build/tests/pulsar-tests --gtest_filter='*testTlsDetectPulsarSsl' ``` ### Anything else? _No response_ ### Are you willing to submit a PR? - [X] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
