io.c: bind_inet_socket() bind failed Address already inuse
We use syslog-ng 1.6.12 in RHEL4. As part of our system testing we restart syslog-ng 150 times in a loop along with other services in the server.
syslog-ng fails to come up 3/4 times with the error : "io.c: bind_inet_socket() bind failed 192.168.128.1:601 Address already in use".
How do you restart syslog-ng? It takes some time to close sources/ destinations and there is a chance that the new syslog-ng instance tries to bind to the same address the not-yet-stopped instance still uses.
Does syslog-ng use SO_REUSEADDR option ?
On Wed, 2008-04-09 at 18:05 +0300, Lucky Y wrote:
We use syslog-ng 1.6.12 in RHEL4. As part of our system testing we restart syslog-ng 150 times in a loop along with other services in the server.
syslog-ng fails to come up 3/4 times with the error : "io.c: bind_inet_socket() bind failed 192.168.128.1:601 Address already in use".
How do you restart syslog-ng? It takes some time to close sources/ destinations and there is a chance that the new syslog-ng instance tries to bind to the same address the not-yet-stopped instance still uses.
Does syslog-ng use SO_REUSEADDR option ?
Of course. -- Bazsi
Balazs Scheidler wrote:
On Wed, 2008-04-09 at 18:05 +0300, Lucky Y wrote:
We use syslog-ng 1.6.12 in RHEL4. As part of our system testing we restart syslog-ng 150 times in a loop along with other services in the server.
syslog-ng fails to come up 3/4 times with the error : "io.c: bind_inet_socket() bind failed 192.168.128.1:601 Address already in use". How do you restart syslog-ng? It takes some time to close sources/ destinations and there is a chance that the new syslog-ng instance tries to bind to the same address the not-yet-stopped instance still uses. Does syslog-ng use SO_REUSEADDR option ?
Of course.
Does syslog-ng close the socket *before* flushing its buffers and closing it's files? Doing so would address this race condition (kill, start without waiting), but it would introduce another race where the new syslog-ng would be opening files that are not yet closed by the old syslog-ng. The "restart" method used should ensure that the process is finished prior to starting another one. -- Evan Rempel erempel@uvic.ca Senior Programmer Analyst 250.721.7691 Computing Services University of Victoria
On Wed, 2008-04-09 at 12:35 -0700, Evan Rempel wrote:
Balazs Scheidler wrote:
On Wed, 2008-04-09 at 18:05 +0300, Lucky Y wrote:
We use syslog-ng 1.6.12 in RHEL4. As part of our system testing we restart syslog-ng 150 times in a loop along with other services in the server.
syslog-ng fails to come up 3/4 times with the error : "io.c: bind_inet_socket() bind failed 192.168.128.1:601 Address already in use". How do you restart syslog-ng? It takes some time to close sources/ destinations and there is a chance that the new syslog-ng instance tries to bind to the same address the not-yet-stopped instance still uses. Does syslog-ng use SO_REUSEADDR option ?
Of course.
Does syslog-ng close the socket *before* flushing its buffers and closing it's files?
Now as you mention it, it does not call shutdown() on the socket, albeit it should. I've filed a bugreport about this.
Doing so would address this race condition (kill, start without waiting), but it would introduce another race where the new syslog-ng would be opening files that are not yet closed by the old syslog-ng.
This is what happens, I think.
The "restart" method used should ensure that the process is finished prior to starting another one.
True. Most of the init scripts were outside contributions, but we are in the process of rewriting and unifying them on all platforms. But this has not happened yet. -- Bazsi
participants (3)
-
Balazs Scheidler
-
Evan Rempel
-
Lucky Y