Comment 5 for bug 1342068

Revision history for this message
Alexei Sheplyakov (asheplyakov) wrote : Re: syslog logging to /dev/log race condition in python 2.6

The current version of python shipped with CentOS 6.5 already includes the fix (or rather a work around):

$ cat python-2.6.6-fix-SysLogHandler-error-handling.patch
diff -up Python-2.6.6/Lib/logging/handlers.py.15179 Python-2.6.6/Lib/logging/handlers.py
--- Python-2.6.6/Lib/logging/handlers.py.15179 2010-05-24 05:43:13.000000000 -0400
+++ Python-2.6.6/Lib/logging/handlers.py 2012-10-11 20:45:18.849380832 -0400
@@ -727,7 +727,11 @@ class SysLogHandler(logging.Handler):
         except socket.error:
             self.socket.close()
             self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
- self.socket.connect(address)
+ try:
+ self.socket.connect(address)
+ except socket.error:
+ self.socket.close()
+ raise

     # curious: when talking to the unix-domain '/dev/log' socket, a
     # zero-terminator seems to be required. this string is placed