Skip to content

Commit

Permalink
HPCC-31990 Add timeout to DNS lookups for soapcalls using a threadpool 2
Browse files Browse the repository at this point in the history
Signed-off-by: M Kelly <[email protected]>
  • Loading branch information
mckellyln committed Jul 23, 2024
1 parent 76fe6af commit 2c2cd62
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions system/jlib/jsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,12 @@ class CAddrPoolThread : public CInterface, implements IPooledThread

virtual void init(void *param) override
{
localAddrThreadInfo.set((CAddrInfoThreadArgs *)param);
localAddrThreadInfo.setown((CAddrInfoThreadArgs *)param);
}

virtual void threadmain() override
{
localAddrThreadInfo->result = getAddressInfo(localAddrThreadInfo->name.get(), localAddrThreadInfo->netaddr, false);
localAddrThreadInfo->Release();
}

virtual bool stop() override
Expand Down Expand Up @@ -542,7 +541,7 @@ static bool useDNSTimeout()
if (!addrInfoPool)
{
addrInfoFactory.setown(new CAddrInfoFactory);
addrInfoPool.setown(createThreadPool("AddrInfoPool", addrInfoFactory, false, nullptr, maxDNSThreads, 100000000));
addrInfoPool.setown(createThreadPool("AddrInfoPool", addrInfoFactory, true, nullptr, maxDNSThreads, 100000000));
}
}
return true;
Expand Down Expand Up @@ -3606,6 +3605,8 @@ static bool lookupHostAddress(const char *name, unsigned *netaddr, unsigned time
return true;
}
}
// if join() returns false thread still running, but its detached,
// will terminate, release thread args and return to pool on its own ...

StringBuffer emsg;
emsg.appendf("getaddrinfo timed out (thread) (%d)", timeoutms);
Expand Down

0 comments on commit 2c2cd62

Please sign in to comment.