Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
8f84117409
1 muutettua tiedostoa jossa 19 lisäystä ja 20 poistoa
  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;
                     }
                 }