fgerlits commented on code in PR #2254:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2254#discussion_r4024368256


##########
extension-framework/include/utils/net/ConnectionHandler.h:
##########
@@ -64,7 +66,7 @@ class ConnectionHandler final : public ConnectionHandlerBase {
   [[nodiscard]] asio::awaitable<std::error_code> 
setupUsableSocket(asio::io_context& io_context) override;
   [[nodiscard]] bool hasUsableSocket() const { return socket_ && 
socket_->lowest_layer().is_open(); }
 
-  asio::awaitable<std::error_code> establishNewConnection(const 
asio::ip::tcp::resolver::results_type& endpoints, asio::io_context& 
io_context_);
+  asio::awaitable<std::error_code> establishNewConnection(const 
std::vector<asio::ip::tcp::endpoint>& endpoints, asio::io_context& io_context_);

Review Comment:
   There was a leak in `ConnectionHandler<SocketType>::setupUsableSocket` 
(lines 147-163 in the same file) because the `resolve_result` did not get 
deleted properly. I don't completely understand why this happened(*), but the 
fix was to copy the endpoints from the `resolve_result` and let it go out of 
scope before the next `co_await` is called.
   
   Using `span` instead `vector` as the argument type is a good idea, done in 
0dcbf880b53a9921b5bbd43f73c2e4240f816130.
   
   (*) it may be related to 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124584, as I have checked that it 
happens on GCC 15, 16, but doesn't happen on GCC 13, 14 and Clang 20.



-- 
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]

Reply via email to