Sfoglia il codice sorgente

HPCC-24597 ESP cores when calling roxie reloadCluster

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexisrisk.com>
Anthony Fishbeck 4 anni fa
parent
commit
012ea7d227

+ 5 - 0
common/roxiecommlib/roxiecommunicationclient.cpp

@@ -24,6 +24,7 @@
 
 
 #define GET_LOCK_FAILURE            1100
+#define EMPTY_RESULT_FAILURE        1200
 
 //////////////////////////////////////////
 class CRoxieCommunicationClient: implements IRoxieCommunicationClient, public CInterface
@@ -80,7 +81,11 @@ protected:
             _WINREV(sendlen);
             sock->read(response.reserveTruncate(sendlen), sendlen);
         }
+        if (response.isEmpty())
+            throw MakeStringException(EMPTY_RESULT_FAILURE, "CRoxieCommunicationClient empty response for control request(%s)", xml);
         Owned<IPropertyTree> ret = createPTreeFromXMLString(response.str());
+        if (!ret)
+            throw MakeStringException(EMPTY_RESULT_FAILURE, "CRoxieCommunicationClient empty result tree for control request(%s)", xml);
         Owned<IMultiException> me = MakeMultiException();
         Owned<IPropertyTreeIterator> endpoints = ret->getElements("Endpoint");
         ForEach(*endpoints)

+ 9 - 3
esp/clients/roxiecontrol.cpp

@@ -20,10 +20,12 @@
 
 const unsigned roxieQueryRoxieTimeOut = 60000;
 
-void checkRoxieControlExceptions(IPropertyTree *msg)
+#define EMPTY_RESULT_FAILURE 1200
+
+static void checkRoxieControlExceptions(IPropertyTree *response)
 {
     Owned<IMultiException> me = MakeMultiException();
-    Owned<IPropertyTreeIterator> endpoints = msg->getElements("Endpoint");
+    Owned<IPropertyTreeIterator> endpoints = response->getElements("Endpoint");
     ForEach(*endpoints)
     {
         IPropertyTree &endp = endpoints->query();
@@ -65,8 +67,12 @@ IPropertyTree *sendRoxieControlQuery(ISocket *sock, const char *msg, unsigned wa
         if (size_read<len)
             throw MakeStringException(-1, "Error reading roxie control message response");
     }
-
+    if (resp.isEmpty())
+        throw MakeStringException(EMPTY_RESULT_FAILURE, "Empty response string for roxie control request(%s) wait(%d)", msg, wait);
     Owned<IPropertyTree> ret = createPTreeFromXMLString(resp.str());
+    if (!ret)
+        throw MakeStringException(EMPTY_RESULT_FAILURE, "Empty result tree for roxie control request(%s) wait(%d)", msg, wait);
+
     checkRoxieControlExceptions(ret);
     return ret.getClear();
 }