diff --git a/utils/common/pipe.h b/utils/common/pipe.h index de25dd1ae..17ac16330 100644 --- a/utils/common/pipe.h +++ b/utils/common/pipe.h @@ -20,6 +20,11 @@ /* A helper class to hold the file descriptors returned from a pipe() call. */ +#include +#include +#include +#include + class Pipe { int fd[2]; @@ -60,7 +65,7 @@ class Pipe FD_ZERO(&rfds); FD_SET(fd[0], &rfds); struct timeval tmptv = tv; - int retval = select(fd[0] + 1, &rfds, NULL, NULL, &tmptv); + int retval = select(fd[0] + 1, &rfds, nullptr, nullptr, &tmptv); if (retval == -1) return -1; if (!retval) diff --git a/utils/common/service.h b/utils/common/service.h index a4c25f296..898b587ec 100644 --- a/utils/common/service.h +++ b/utils/common/service.h @@ -18,11 +18,16 @@ #pragma once #include +#include +#include #include "pipe.h" class Service { protected: + // The read operation implicitly controls how long binary waits + // before it starts. This is import for DMLProc to survive rollbacks. See MCOL-5105. + static constexpr const size_t PipeReadTimeout = 1200; // The service name, for logging const std::string m_name; // The pipe to send messages from the child to the parent @@ -62,7 +67,7 @@ class Service { char str[100]; // Read the message from the child - ssize_t nbytes = m_pipe.readtm({120, 0}, str, sizeof(str)); + ssize_t nbytes = m_pipe.readtm({PipeReadTimeout, 0}, str, sizeof(str)); if (nbytes >= 0) { ParentLogChildMessage(std::string(str, nbytes));