[
https://issues.apache.org/jira/browse/GEODE-8847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17269927#comment-17269927
]
ASF GitHub Bot commented on GEODE-8847:
---------------------------------------
pivotal-jbarrett commented on a change in pull request #726:
URL: https://github.com/apache/geode-native/pull/726#discussion_r561348935
##########
File path: cppcache/src/TcpConn.cpp
##########
@@ -113,16 +113,11 @@ TcpConn::TcpConn(const std::string ipaddr,
TcpConn::TcpConn(const std::string host, uint16_t port,
std::chrono::microseconds timeout, int32_t maxBuffSizePool)
: socket_{io_context_} {
- auto beforeResolvePoint = std::chrono::system_clock::now();
- auto results = resolve(host, port, timeout);
- auto elapsedTime = std::chrono::duration<double, std::micro>(
- std::chrono::system_clock::now() - beforeResolvePoint);
+ auto results = resolve(host, port);
Review comment:
Ok, looking at the original organization of the code using ACE the
resolve step was not included in the timeout. The resolve happened on the
construction of the `TcpConn` when it initialized the `ACE_INET_Addr` member.
The timeout was only used for the connect phase. This change seems consistent
with that change.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
> Use boost::asio::ip::tcp::resolver::resolve method instead of the
> asynchronous one
> ----------------------------------------------------------------------------------
>
> Key: GEODE-8847
> URL: https://issues.apache.org/jira/browse/GEODE-8847
> Project: Geode
> Issue Type: Improvement
> Components: native client
> Reporter: Alberto Gomez
> Assignee: Alberto Gomez
> Priority: Major
> Labels: pull-request-available
>
> The async_resolve method of the boost::asio::ip::tcp::resolver class allows
> to perform asynchronous calls for name resolution which would, in theory,
> permit to add a timeout to the name resolution, useful when DNS calls take
> long.
> In practice, it has been observed that this call creates a thread internally
> and even if a timeout is set in the io_context run method and the call exits
> at timeout, subsequent calls to run or the destruction of the io_context will
> wait for the thread created by the async_resolve method to finish which
> provokes that calls to the resolver can take longer than the timeout set.
> As a consequence, it is proposed to use the synchronous version of the method
> (resolve) which makes the code simpler and does not lead to interpret that a
> timeout out can be set to the name resolution.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)