Quellcode durchsuchen

HPCC-8381 agentexec segfaults and doesn't restart

The common job queue code in connlock cores if there is a timeout because
it later dereferences the NULL pconn object. This fix checks for NULL
before dereferencing

Signed-off-by: William Whitehead <william.whitehead@lexisnexis.com>
William Whitehead vor 12 Jahren
Ursprung
Commit
6dd1019fca
1 geänderte Dateien mit 10 neuen und 10 gelöschten Zeilen
  1. 10 10
      common/workunit/wujobq.cpp

+ 10 - 10
common/workunit/wujobq.cpp

@@ -511,6 +511,16 @@ public:
                             pconn.setown(querySDS().connect("/JobQueues",myProcessSession(),RTM_LOCK_WRITE|RTM_CREATE_QUERY,wait));
                             if (!pconn)
                                 throw MakeStringException(-1,"CJobQueue could not create JobQueues");
+                            IPropertyTree *proot = pconn->queryRoot();
+                            StringBuffer cpath;
+                            cpath.appendf("Queue[@name=\"%s\"]",qd->qname.get());
+                            if (!proot->hasProp(cpath.str())) {
+                                IPropertyTree *pt = proot->addPropTree("Queue",createPTree("Queue"));
+                                pt->setProp("@name",qd->qname.get());
+                                pt->setProp("@state","active");
+                                pt->setPropInt("@count", 0);
+                                pt->setPropInt("Edition", 1);
+                            }
                         }
                         catch (ISDSException *e) {
                             if (SDSExcpt_LockTimeout != e->errorCode())
@@ -518,16 +528,6 @@ public:
                             e->Release();
                             timeout = true;
                         }
-                        IPropertyTree *proot = pconn->queryRoot();
-                        StringBuffer cpath;
-                        cpath.appendf("Queue[@name=\"%s\"]",qd->qname.get());
-                        if (!proot->hasProp(cpath.str())) {
-                            IPropertyTree *pt = proot->addPropTree("Queue",createPTree("Queue"));
-                            pt->setProp("@name",qd->qname.get());
-                            pt->setProp("@state","active");
-                            pt->setPropInt("@count", 0);
-                            pt->setPropInt("Edition", 1);
-                        }
                     }
                     if (!timeout)
                         break;