소스 검색

gh-1332 - Reduce dafilesrv inactive client logging

A connected inactive client (>12mins), was being checked every minute
to see if was still alive and if it was "Inactice client" messages for all
files from the client were being logged.
This can be excessive in some situations.

Still want to check per minute, but add extra timeout to control frequency
of warning

Signed-off-by: Jake Smith <jake.smith@lexisnexis.com>
Jake Smith 13 년 전
부모
커밋
071cc69557
1개의 변경된 파일15개의 추가작업 그리고 3개의 파일을 삭제
  1. 15 3
      common/remote/sockfile.cpp

+ 15 - 3
common/remote/sockfile.cpp

@@ -202,6 +202,7 @@ bool enableDafsAuthentication(bool on)
 
 
 
 
 #define CLIENT_TIMEOUT      (1000*60*60*12)     // long timeout in case zombies
 #define CLIENT_TIMEOUT      (1000*60*60*12)     // long timeout in case zombies
+#define CLIENT_INACTIVEWARNING_TIMEOUT (1000*60*60*12) // time between logging inactive clients
 #define SERVER_TIMEOUT      (1000*60*5)         // timeout when waiting for dafilesrv to reply after command
 #define SERVER_TIMEOUT      (1000*60*5)         // timeout when waiting for dafilesrv to reply after command
                                                 // (increased when waiting for large block)
                                                 // (increased when waiting for large block)
 #define DAFS_CONNECT_FAIL_RETRY_TIME (1000*60*15)
 #define DAFS_CONNECT_FAIL_RETRY_TIME (1000*60*15)
@@ -2989,7 +2990,7 @@ class CRemoteFileServer : public CInterface, implements IRemoteFileServer, imple
         Owned<IDirectoryIterator> opendir;
         Owned<IDirectoryIterator> opendir;
         StringAttrArray     opennames;      // for debug
         StringAttrArray     opennames;      // for debug
         IntArray            handles;
         IntArray            handles;
-        unsigned            lasttick;
+        unsigned            lasttick, lastInactiveTick;
         atomic_t            &globallasttick;
         atomic_t            &globallasttick;
         unsigned            previdx;        // for debug
         unsigned            previdx;        // for debug
 
 
@@ -3171,9 +3172,20 @@ class CRemoteFileServer : public CInterface, implements IRemoteFileServer, imple
             return (msTick()-lasttick)>CLIENT_TIMEOUT;
             return (msTick()-lasttick)>CLIENT_TIMEOUT;
         }
         }
 
 
+        bool inactiveTimedOut()
+        {
+            unsigned ms = msTick();
+            if ((ms-lastInactiveTick)>CLIENT_INACTIVEWARNING_TIMEOUT)
+            {
+                lastInactiveTick = ms;
+                return true;
+            }
+            return false;
+        }
+
         void touch()
         void touch()
         {
         {
-            lasttick = msTick();
+            lastInactiveTick = lasttick = msTick();
             atomic_set(&globallasttick,lasttick);
             atomic_set(&globallasttick,lasttick);
         }
         }
 
 
@@ -4531,7 +4543,7 @@ public:
                 StringBuffer s;
                 StringBuffer s;
                 bool ok = client.getInfo(s);    // will spot duff sockets
                 bool ok = client.getInfo(s);    // will spot duff sockets
                 if (ok&&(client.handles.ordinality()!=0))  {
                 if (ok&&(client.handles.ordinality()!=0))  {
-                    if (TF_TRACE_CLIENT_CONN) 
+                    if (TF_TRACE_CLIENT_CONN && client.inactiveTimedOut())
                         WARNLOG("Inactive %s",s.str());
                         WARNLOG("Inactive %s",s.str());
                 }
                 }
                 else {
                 else {