Skip to content
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

Unix style logger (and possibly others) don't reconnect on send error #21

Open
gclinch opened this issue Jun 11, 2017 · 0 comments
Open

Comments

@gclinch
Copy link

gclinch commented Jun 11, 2017

This library continues to attempt to send to a broken fd (for example if the syslogd is restarted, causing /dev/log to have a new inode), as seen in this strace snippet:

sendto(3, "<150>Jun 11 21:36:55 syslog-test"..., 47, 0, NULL, 0) = 47
nanosleep({1, 0}, 0x7ffca177d970)       = 0
sendto(3, "<150>Jun 11 21:36:56 syslog-test"..., 47, 0, NULL, 0) = 47
nanosleep({1, 0}, 0x7ffca177d970)       = 0
sendto(3, "<150>Jun 11 21:36:57 syslog-test"..., 47, 0, NULL, 0) = -1 ECONNREFUSED (Connection refused)
nanosleep({1, 0}, 0x7ffca177d970)       = 0
sendto(3, "<150>Jun 11 21:36:58 syslog-test"..., 47, 0, NULL, 0) = -1 ENOTCONN (Transport endpoint is not connected)
nanosleep({1, 0}, 0x7ffca177d970)       = 0
sendto(3, "<150>Jun 11 21:36:59 syslog-test"..., 47, 0, NULL, 0) = -1 ENOTCONN (Transport endpoint is not connected)

Whereas the libc syslog function automatically reconnects:

sendto(3, "<14>Jun 11 21:34:38 syslog-test."..., 47, MSG_NOSIGNAL, NULL, 0) = 47
select(0, NULL, NULL, NULL, {1, 0})     = 0 (Timeout)
sendto(3, "<14>Jun 11 21:34:39 syslog-test."..., 47, MSG_NOSIGNAL, NULL, 0) = 47
select(0, NULL, NULL, NULL, {1, 0})     = 0 (Timeout)
sendto(3, "<14>Jun 11 21:34:40 syslog-test."..., 47, MSG_NOSIGNAL, NULL, 0) = -1 ECONNREFUSED (Connection refused)
close(3)                                = 0
socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
connect(3, {sa_family=AF_LOCAL, sun_path="/dev/log"}, 110) = 0
sendto(3, "<14>Jun 11 21:34:40 syslog-test."..., 47, MSG_NOSIGNAL, NULL, 0) = 47
select(0, NULL, NULL, NULL, {1, 0})     = 0 (Timeout)
sendto(3, "<14>Jun 11 21:34:41 syslog-test."..., 47, MSG_NOSIGNAL, NULL, 0) = 47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant