瀏覽代碼

HPCC-14864 Roxie start fails in container due to RMEM_MAX missing

Just warn if no value can be read.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 年之前
父節點
當前提交
a7ab43c144
共有 6 個文件被更改,包括 18 次插入66 次删除
  1. 0 2
      roxie/ccd/ccdmain.cpp
  2. 0 1
      roxie/udplib/udplib.hpp
  3. 10 32
      roxie/udplib/udpsha.cpp
  4. 4 15
      roxie/udplib/udptrr.cpp
  5. 2 10
      roxie/udplib/udptrs.cpp
  6. 2 6
      roxie/udplib/uttest.cpp

+ 0 - 2
roxie/ccd/ccdmain.cpp

@@ -711,8 +711,6 @@ int STARTQUERY_API start_query(int argc, const char *argv[])
         // MORE: think of a better way/value/check maybe/and/or based on Roxie server timeout
         if (udpRequestToSendTimeout == 0)
             udpRequestToSendTimeout = 5; 
-        // This is not added to deployment\xmlenv\roxie.xsd on purpose
-        enableSocketMaxSetting = topology->getPropBool("@enableSocketMaxSetting", false);
         // MORE: might want to check socket buffer sizes against sys max here instead of udp threads ?
         udpMulticastBufferSize = topology->getPropInt("@udpMulticastBufferSize", 262142);
         udpFlowSocketsSize = topology->getPropInt("@udpFlowSocketsSize", 131072);

+ 0 - 1
roxie/udplib/udplib.hpp

@@ -129,7 +129,6 @@ extern UDPLIB_API unsigned multicastTTL;
 extern UDPLIB_API void setLinuxThreadPriority(int level);
 #endif
 
-extern UDPLIB_API bool enableSocketMaxSetting;
 extern UDPLIB_API unsigned udpFlowSocketsSize;
 extern UDPLIB_API unsigned udpLocalWriteSocketSize;
 extern UDPLIB_API unsigned udpMaxRetryTimedoutReqs;

+ 10 - 32
roxie/udplib/udpsha.cpp

@@ -39,7 +39,6 @@ IDataBufferManager *bufferManager;
 
 unsigned udpTraceLevel = 0;
 unsigned udpTraceCategories = (unsigned) -1;
-bool     enableSocketMaxSetting = false;
 unsigned udpFlowSocketsSize = 131072;
 unsigned udpLocalWriteSocketSize = 1024000;
 
@@ -245,7 +244,7 @@ bool queue_t::dataQueued(void *key, PKT_CMP_FUN pkCmpFn)
 #include <netdb.h>
 #endif
 
-int check_set(const char *path, int value, bool modify)
+int check_set(const char *path, int value)
 {
 #ifdef __linux__
     FILE *f = fopen(path,"r");
@@ -256,45 +255,24 @@ int check_set(const char *path, int value, bool modify)
         r = fgets(res, sizeof(res), f);
         fclose(f);
     }
-    if (r) {
+    if (r)
         si = atoi(r);
+    if (!si)
+    {
+        DBGLOG("WARNING: Failed to read value for %s", path);
+        return 0;
     }
-    if (si<value) {
-        if (modify) {
-            f = fopen(path,"w");
-            if (f) {
-                sprintf(res, "%i", value);
-                fputs(res,f);
-                fclose(f);
-                DBGLOG("%s changed from %i to %i", path, si, value);
-                return 1;
-            } 
-            else {
-                DBGLOG("%s not set", path);
-                return -1;
-            }
-        }
-        else {
-            DBGLOG("%s value %i is less than %i", path, si, value);
-            return -1;
-        }
-    }
+    else if (si<value)
+        return -1;
 #endif
     return 0;
 }
 
-int check_set_max_socket_read_buffer(int size) {
-    return check_set("/proc/sys/net/core/rmem_max", size, true);
-}
-int check_set_max_socket_write_buffer(int size) {
-    return check_set("/proc/sys/net/core/wmem_max", size, true);
-}
-
 int check_max_socket_read_buffer(int size) {
-    return check_set("/proc/sys/net/core/rmem_max", size, false);
+    return check_set("/proc/sys/net/core/rmem_max", size);
 }
 int check_max_socket_write_buffer(int size) {
-    return check_set("/proc/sys/net/core/wmem_max", size, false);
+    return check_set("/proc/sys/net/core/wmem_max", size);
 }
 
 #ifdef __linux__

+ 4 - 15
roxie/udplib/udptrr.cpp

@@ -494,11 +494,8 @@ class CReceiveManager : public CInterface, implements IReceiveManager
         {
             snifferTable = new SnifferEntry[numNodes];
             sniffer_socket = ISocket::multicast_create(snifferPort, snifferIP, multicastTTL);
-            if (check_max_socket_read_buffer(udpFlowSocketsSize) < 0) {
-                if (!enableSocketMaxSetting)
-                    throw MakeStringException(ROXIE_UDP_ERROR, "System Socket max read buffer is less than %i", udpFlowSocketsSize);
-                check_set_max_socket_read_buffer(udpFlowSocketsSize);
-            }
+            if (check_max_socket_read_buffer(udpFlowSocketsSize) < 0)
+                throw MakeStringException(ROXIE_UDP_ERROR, "System Socket max read buffer is less than %i", udpFlowSocketsSize);
             sniffer_socket->set_receive_buffer_size(udpFlowSocketsSize);
             if (udpTraceLevel)
             {
@@ -586,11 +583,7 @@ class CReceiveManager : public CInterface, implements IReceiveManager
         {
             flow_port = flow_p;
             if (check_max_socket_read_buffer(udpFlowSocketsSize) < 0) 
-            {
-                if (!enableSocketMaxSetting)
-                    throw MakeStringException(ROXIE_UDP_ERROR, "System Socket max read buffer is less than %i", udpFlowSocketsSize);
-                check_set_max_socket_read_buffer(udpFlowSocketsSize);
-            }
+                throw MakeStringException(ROXIE_UDP_ERROR, "System Socket max read buffer is less than %i", udpFlowSocketsSize);
             flow_socket.setown(ISocket::udp_create(flow_port));
             flow_socket->set_receive_buffer_size(udpFlowSocketsSize);
             size32_t actualSize = flow_socket->get_receive_buffer_size();
@@ -683,11 +676,7 @@ class CReceiveManager : public CInterface, implements IReceiveManager
             unsigned ip_buffer = parent.input_queue_size*DATA_PAYLOAD;
             if (ip_buffer < udpFlowSocketsSize) ip_buffer = udpFlowSocketsSize;
             if (check_max_socket_read_buffer(ip_buffer) < 0) 
-            {
-                if (!enableSocketMaxSetting)
-                    throw MakeStringException(ROXIE_UDP_ERROR, "System socket max read buffer is less than %u", ip_buffer);
-                check_set_max_socket_read_buffer(ip_buffer);
-            }
+                throw MakeStringException(ROXIE_UDP_ERROR, "System socket max read buffer is less than %u", ip_buffer);
             receive_socket = ISocket::udp_create(parent.data_port);
             receive_socket->set_receive_buffer_size(ip_buffer);
             size32_t actualSize = receive_socket->get_receive_buffer_size();

+ 2 - 10
roxie/udplib/udptrs.cpp

@@ -696,11 +696,7 @@ class CSendManager : public CInterface, implements ISendManager
         {
             receive_port = r_port;
             if (check_max_socket_read_buffer(udpFlowSocketsSize) < 0) 
-            {
-                if (!enableSocketMaxSetting)
-                    throw MakeStringException(ROXIE_UDP_ERROR, "System Socket max read buffer is less than %i", udpFlowSocketsSize);
-                check_set_max_socket_read_buffer(udpFlowSocketsSize);
-            }
+                throw MakeStringException(ROXIE_UDP_ERROR, "System Socket max read buffer is less than %i", udpFlowSocketsSize);
             flow_socket.setown(ISocket::udp_create(receive_port));
             flow_socket->set_receive_buffer_size(udpFlowSocketsSize);
             size32_t actualSize = flow_socket->get_receive_buffer_size();
@@ -821,11 +817,7 @@ class CSendManager : public CInterface, implements ISendManager
         {
             sniffer_socket = NULL;
             if (check_max_socket_write_buffer(udpLocalWriteSocketSize) < 0) 
-            {
-                if (!enableSocketMaxSetting)
-                    throw MakeStringException(ROXIE_UDP_ERROR, "System Socket max write buffer is less than %i", udpLocalWriteSocketSize);
-                check_set_max_socket_write_buffer(udpLocalWriteSocketSize);
-            }
+                throw MakeStringException(ROXIE_UDP_ERROR, "System Socket max write buffer is less than %i", udpLocalWriteSocketSize);
             start();
         }
         

+ 2 - 6
roxie/udplib/uttest.cpp

@@ -44,7 +44,7 @@ void usage()
 {
     printf("USAGE: uttest [options] iprange\n");
     printf("Options are:\n");
-    printf("--enableSocketMaxSetting\n"
+    printf(
         "--jumboFrames\n"
         "--udpLocalWriteSocketSize nn\n"
         "--udpRetryBusySenders nn\n"
@@ -627,11 +627,7 @@ int main(int argc, char * argv[] )
         const char *dash = strchr(ip, '-');
         if (dash==ip)
         {
-            if (strcmp(ip, "--enableSocketMaxSetting")==0)
-            {
-                enableSocketMaxSetting = true;
-            }
-            else if (strcmp(ip, "--udpQueueSize")==0)
+            if (strcmp(ip, "--udpQueueSize")==0)
             {
                 c++;
                 if (c==argc || !isdigit(*argv[c]))