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 12, 2024
1 parent 384469e commit d51a5a6
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 116 deletions.
11 changes: 8 additions & 3 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,7 +2468,10 @@ 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()));

Expand All @@ -2488,7 +2491,10 @@ 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)
{
#ifdef _USE_OPENSSL
Expand All @@ -2514,7 +2520,6 @@ class CWSCAsyncFor : implements IWSCAsyncFor, public CInterface, public CAsyncFo
err.append(": OpenSSL disabled in build");
throw makeStringException(0, err.str());
#endif

}
}
break;
Expand Down
Loading

0 comments on commit d51a5a6

Please sign in to comment.