Skip to content

Commit

Permalink
HPCC-31990 Add timeout to DNS lookups for soapcalls
Browse files Browse the repository at this point in the history
Signed-off-by: M Kelly <[email protected]>
  • Loading branch information
mckellyln committed Jun 11, 2024
1 parent 384469e commit 3bf8ef0
Show file tree
Hide file tree
Showing 4 changed files with 330 additions and 79 deletions.
10 changes: 8 additions & 2 deletions common/thorhelper/thorsoapcall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ class BlackLister : public CInterface, implements IThreadFactory
{
if (e->errorCode() == ROXIE_ABORT_EVENT)
throw;
// MCK - do we checkTimeLimitExceeded(&remainingMS) and possibly error out if timelimit exceeded ?
// TODO: do we checkTimeLimitExceeded(&remainingMS) and possibly error out if timelimit exceeded ?
if (numAttemptsRemaining > 0)
{
e->Release();
Expand Down Expand Up @@ -2468,11 +2468,14 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
{
checkTimeLimitExceeded(&remainingMS);
Url &connUrl = master->proxyUrlArray.empty() ? url : master->proxyUrlArray.item(0);
ep.set(connUrl.host.get(), connUrl.port);

// TODO: for DNS, do we use timeoutMS or remainingMS or remainingMS / maxRetries+1 or ?
ep.set(connUrl.host.get(), connUrl.port, master->timeoutMS);
if (ep.isNull())
throw MakeStringException(-1, "Failed to resolve host '%s'", nullText(connUrl.host.get()));

checkTimeLimitExceeded(&remainingMS); // after ep.set which might make a potentially long getaddrinfo lookup ...

if (strieq(url.method, "https"))
proto = PersistentProtocol::ProtoTLS;

Expand All @@ -2488,6 +2491,8 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
{
isReused = false;
keepAlive = true;

// TODO: for each connect attempt, do we use timeoutMS or remainingMS or remainingMS / maxRetries or ?
socket.setown(blacklist->connect(ep, master->logctx, (unsigned)master->maxRetries, master->timeoutMS, master->roxieAbortMonitor, master->rowProvider));
if (proto == PersistentProtocol::ProtoTLS)
{
Expand Down Expand Up @@ -2516,6 +2521,7 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
#endif

}

}
break;
}
Expand Down
Loading

0 comments on commit 3bf8ef0

Please sign in to comment.