Skip to content

Commit

Permalink
increase TCP timeout to 40 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Jan 15, 2021
1 parent 4638c11 commit 2702e60
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/remote/codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,18 @@ void BlockingTCPTransportCodec::sendThread()

void BlockingTCPTransportCodec::setRxTimeout(bool ena)
{
double timeout = !ena ? 0.0 : std::max(0.0, _context->getConfiguration()->getPropertyAsDouble("EPICS_PVA_CONN_TMO", 30.0));
/* Inactivity timeouts with PVA have a long (and growing) history.
*
* - Originally pvAccessCPP clients didn't send CMD_ECHO, and servers would never timeout.
* - Since module version 7.0.0 (in Base 7.0.3) clients send echo every 15 seconds, and
* either peer will timeout after 30 seconds of inactivity.
* - pvAccessJava clients send CMD_ECHO every 30 seconds, and timeout after 60 seconds.
*
* So this was a bug, with c++ server timeout racing with Java client echo.
*
* - As a compromise, continue to send echo every 15 seconds, but increase default timeout to 40.
*/
double timeout = !ena ? 0.0 : 4.0/3.0*std::max(0.0, _context->getConfiguration()->getPropertyAsDouble("EPICS_PVA_CONN_TMO", 30.0));
#ifdef _WIN32
DWORD timo = DWORD(timeout*1000); // in milliseconds
#else
Expand Down

0 comments on commit 2702e60

Please sign in to comment.