-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support socket timeout in SysLogHandler to prevent indefinite blocking on socket creation #126400
Comments
If I remember correct, the |
Syslog uses both UDP and TCP. A timeout is crucial to avoid blocking the process if the service is unreachable or slow to respond. In my case, I'm using TCP, and the server is unreachable, causing my process to be blocked indefinitely. Adding timeout support to SysLogHandler would allow the application to fail gracefully in such scenarios, instead of hanging due to network issues. |
Hey @picnixz I can take care of this—could you assign me to it? |
Before starting the implementation, I wonder whether this should count as a bug fix or not (and whether there is another way to fix it). So let's ask @vsajip first. |
Yes, this seems a reasonable feature to add. You're welcome to submit a PR with docs/tests. |
Feature or enhancement
Proposal:
Hi,
In the current implementation of the SysLogHandler class from the logging.handlers module, if the specified address does not respond or is unreachable, the createSocket method may block indefinitely. This is problematic because there is no way to set a socket timeout during the connection's creation without overriding the entire createSocket method.
The only way to add timeout is to override the whole createSocket method (if I use super().createSocket() it will get stuck on this line)
my suggestion:
Thanks
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: