This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: backwards-incompatible change in SysLogHandler with unix domain sockets
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: novas0x2a, python-dev, vinay.sajip
Priority: normal Keywords: patch

Created on 2013-04-19 06:58 by novas0x2a, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
0001-Restore-SysLogHandler-fallback-for-AF_UNIX-sockets.patch novas0x2a, 2013-04-19 06:58
alternative-approach.diff vinay.sajip, 2013-04-20 13:03 Alternative patch review
updated-alternative-approach.diff vinay.sajip, 2013-04-21 19:20 Updated to use default socktype=None review
Repositories containing patches
http://hg.python.org/sandbox/vsajip#fix17795
Messages (8)
msg187347 - (view) Author: Mike Lundy (novas0x2a) * Date: 2013-04-19 06:58
The changed merged from http://bugs.python.org/issue16168 causes a regression in SysLogHandler behavior. The socktype of /dev/log is dependent on syslog configuration, and the fallback behavior (trying SOCK_DGRAM and then SOCK_STREAM if the former failed) was very useful.

A better fix for this would preserve the fallback behavior in cases where the caller has not specifically requested a socktype. I've attached a patch with one such approach.
msg187421 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2013-04-20 13:08
I've attached an alternative patch. The default socktype stays as socket.SOCK_DGRAM, but you can specify socktype=None to get the SOCK_DGRAM falling back to SOCK_STREAM behaviour.

Can you confirm that this alternative approach works in your environment? (This patch is against the default branch.)
msg187449 - (view) Author: Mike Lundy (novas0x2a) * Date: 2013-04-20 18:30
It doesn't fix it unless I change the configuration (and in some cases the code) for every SyslogHandler across all of our projects, plus every single library we use. Google around For "SysLogHandler /dev/log socktype" and then compare with "SysLogHandler /dev/log". You won't find many hits where people set socktype, because people knew that SyslogHandler just Did The Right Thing when presented with an AF_UNIX. That has been the behavior since the logging module was introduced in 2.3.

I'm just asking that you preserve the default behavior that has existed since python 2.3- that was the purpose of my patch. I'm not tied to how I implemented it (I mean, it is kind of ugly) but I believe preserving the behavior is important, and I also believe that it will break less code than what is currently there (because, after all, socktype was only introduced in 2.7, the SysLogHandler doesn't care if it's None, and subclasses couldn't have relied on it in the AF_UNIX case because the original fallback didn't update it)
msg187464 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2013-04-20 21:26
Does that mean that if I just change the default back to socktype=None, that will be good enough?
msg187475 - (view) Author: Mike Lundy (novas0x2a) * Date: 2013-04-20 22:57
On top of your patch? Yeah, I think so. (I wrote it the way I did so it could handle syslog configuration changes, but that's kind of an uncommon case).

Thanks!
msg187518 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2013-04-21 19:23
Okay, I made the change to default socktype=None. Please try out the latest patch (ideally on all Python versions you can test with) to confirm it's OK. Then I can apply to 2.7/3.2/3.3/default. Thanks.
msg187544 - (view) Author: Mike Lundy (novas0x2a) * Date: 2013-04-22 02:45
I've tested in our full dev setup, and it seems to work fine; I've also tested on my laptop, no problems there either.

Unfortunately, that's python 2.7.4 in both cases. I don't really have a python3 setup I can bump up to test.
msg187550 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-04-22 09:14
New changeset 32a5de0e91d5 by Vinay Sajip in branch '2.7':
Issue #17795: Reverted backwards-incompatible change in SysLogHandler with Unix domain sockets.
http://hg.python.org/cpython/rev/32a5de0e91d5

New changeset d03784713786 by Vinay Sajip in branch '3.3':
Issue #17795: Reverted backwards-incompatible change in SysLogHandler with Unix domain sockets.
http://hg.python.org/cpython/rev/d03784713786

New changeset 9c0a677dbbc0 by Vinay Sajip in branch 'default':
Closes #17795: Reverted backwards-incompatible change in SysLogHandler with Unix domain sockets.
http://hg.python.org/cpython/rev/9c0a677dbbc0
History
Date User Action Args
2022-04-11 14:57:44adminsetgithub: 61995
2013-04-22 09:14:27python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg187550

resolution: fixed
stage: resolved
2013-04-22 02:45:27novas0x2asetmessages: + msg187544
2013-04-21 19:23:24vinay.sajipsetmessages: + msg187518
2013-04-21 19:20:29vinay.sajipsetfiles: + updated-alternative-approach.diff
2013-04-20 22:57:46novas0x2asetmessages: + msg187475
2013-04-20 21:26:47vinay.sajipsetmessages: + msg187464
2013-04-20 18:30:01novas0x2asetmessages: + msg187449
2013-04-20 13:08:21vinay.sajipsetmessages: + msg187421
2013-04-20 13:03:01vinay.sajipsetfiles: + alternative-approach.diff
2013-04-20 13:02:32vinay.sajipsethgrepos: + hgrepo183
2013-04-19 10:21:38vinay.sajipsetassignee: vinay.sajip

nosy: + vinay.sajip
2013-04-19 06:58:32novas0x2acreate