Bug 237886 - logging/handlers.py doesn't always set unixsocket
logging/handlers.py doesn't always set unixsocket
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: python (Show other bugs)
6
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jeremy Katz
Brock Organ
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-25 16:59 EDT by Steve Friedman
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-04-30 16:51:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Steve Friedman 2007-04-25 16:59:18 EDT
Description of problem:

I am having a problem (for reasons that I don't understand) that line 630 of
handlers.py claims that unixsocket is undefined.  One way that this can happen
is if the socket creation (either _connect_unixsocket() or socket.socket())
throws an uncaught exception as unixsocket is defined after this point. 


Version-Release number of selected component (if applicable):
python-2.4.4-1.fc6

How reproducible:
Always (if you can get the socket creation to fail).

Steps to Reproduce:
1. Turn of syslog / syslog-ng.
2. Run any python command that uses logging (e.g., yum check-update).
3.
  
Actual results:
The code throws an exception in the close().

Expected results:


Additional info:
The simplest solution is to set unixsocket=0 prior to the if and only set it to
1 after the socket is properly created:

From:
       if type(address) == types.StringType:
            self._connect_unixsocket(address)
            self.unixsocket = 1
        else:
            self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            self.unixsocket = 0

To:
       self.unixsocket = 0
       if type(address) == types.StringType:
            self._connect_unixsocket(address)
            self.unixsocket = 1
        else:
            self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Comment 1 Jeremy Katz 2007-04-30 16:51:45 EDT
Already fixed in rawhide and I've committed the fix to the FC-6 branch of the
python package for the next time I do an update of it.

Note You need to log in before you can comment on or make changes to this bug.