Browse Source

[3074] Add logging

Mukund Sivaraman 11 years ago
parent
commit
33a9204a11
2 changed files with 9 additions and 1 deletions
  1. 3 1
      src/bin/msgq/msgq.py.in
  2. 6 0
      src/bin/msgq/msgq_messages.mes

+ 3 - 1
src/bin/msgq/msgq.py.in

@@ -525,7 +525,9 @@ class MsgQ:
             # Append it to buffer (but check the data go away)
             # Append it to buffer (but check the data go away)
             if fileno in self.sendbuffs:
             if fileno in self.sendbuffs:
                 (last_sent, buff) = self.sendbuffs[fileno]
                 (last_sent, buff) = self.sendbuffs[fileno]
-                if now - last_sent > 0.1:
+                tdelta = now - last_sent
+                if tdelta > 0.1:
+                    logger.error(MSGQ_SOCKET_TIMEOUT_ERROR, fileno, tdelta)
                     self.kill_socket(fileno, sock)
                     self.kill_socket(fileno, sock)
                     return False
                     return False
                 buff += msg
                 buff += msg

+ 6 - 0
src/bin/msgq/msgq_messages.mes

@@ -142,3 +142,9 @@ data structure.
 % MSGQ_SUBS_NEW_TARGET Creating new target for subscription to group '%1' for instance '%2'
 % MSGQ_SUBS_NEW_TARGET Creating new target for subscription to group '%1' for instance '%2'
 Debug message. Creating a new subscription. Also creating a new data structure
 Debug message. Creating a new subscription. Also creating a new data structure
 to hold it.
 to hold it.
+
+% MSGQ_SOCKET_TIMEOUT_ERROR Killing socket %1 because timeout exceeded (%2)
+Outgoing data was queued up on a socket connected to msgq, but the other
+side is not reading it. It could be deadlocked, or may not be monitoring
+it. Both cases are programming errors and should be corrected. The socket
+is closed on the msgq side.