瀏覽代碼

HPCC-22540 Handle secure and rowservice socket accept exceptions

NB: this is similar to HPCC-22525

Previously if accept threw an exception (e.g. due to running out
of handles), it would cause dafilesrv to exit, which caused
clients with established connection to break too.

Catch trace and continue

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 6 年之前
父節點
當前提交
8f84117409
共有 1 個文件被更改,包括 19 次插入20 次删除
  1. 19 20
      fs/dafsserver/dafsserver.cpp

+ 19 - 20
fs/dafsserver/dafsserver.cpp

@@ -4299,6 +4299,7 @@ public:
 
         selecthandler->start();
 
+        Owned<IException> exception;
         for (;;)
         {
             Owned<ISocket> sock;
@@ -4362,9 +4363,13 @@ public:
                     }
                     catch (IException *e)
                     {
-                        EXCLOG(e,"CRemoteFileServer");
-                        e->Release();
-                        continue;
+                        exception.setown(e);
+                    }
+                    if (exception)
+                    {
+                        EXCLOG(exception, "CRemoteFileServer");
+                        exception.clear();
+                        sockavail = false;
                     }
                 }
 
@@ -4393,21 +4398,18 @@ public:
                             sockSSL.setown(ssock.getLink());
                         }
                     }
-                    catch (IJSOCK_Exception *e)
+                    catch (IException *e)
                     {
-                        // accept failed ...
-                        EXCLOG(e,"CRemoteFileServer (secure)");
-                        e->Release();
-                        break;
+                        exception.setown(e);
                     }
-                    catch (IException *e) // IDAFS_Exception also ...
+                    if (exception)
                     {
-                        EXCLOG(e,"CRemoteFileServer1 (secure)");
-                        e->Release();
+                        EXCLOG(exception, "CRemoteFileServer (secure)");
                         cleanupDaFsSocket(sockSSL);
                         sockSSL.clear();
                         cleanupDaFsSocket(ssock);
                         ssock.clear();
+                        exception.clear();
                         securesockavail = false;
                     }
                 }
@@ -4430,21 +4432,18 @@ public:
                             acceptedRSSock.setown(ssock.getLink());
                         }
                     }
-                    catch (IJSOCK_Exception *e)
+                    catch (IException *e)
                     {
-                        // accept failed ...
-                        EXCLOG(e,"CRemoteFileServer (row service)");
-                        e->Release();
-                        break;
+                        exception.setown(e);
                     }
-                    catch (IException *e) // IDAFS_Exception also ...
+                    if (exception)
                     {
-                        EXCLOG(e,"CRemoteFileServer1 (row service)");
-                        e->Release();
+                        EXCLOG(exception, "CRemoteFileServer (row service)");
                         cleanupDaFsSocket(acceptedRSSock);
-                        sockSSL.clear();
+                        acceptedRSSock.clear();
                         cleanupDaFsSocket(ssock);
                         ssock.clear();
+                        exception.clear();
                         rowServiceSockAvail = false;
                     }
                 }