monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit-dev] [monit] r256 committed - fix double close of socket when ssl


From: monit
Subject: [monit-dev] [monit] r256 committed - fix double close of socket when ssl was used ... the race condition cl...
Date: Thu, 16 Sep 2010 11:50:28 +0000

Revision: 256
Author: martin2812
Date: Thu Sep 16 04:49:51 2010
Log: fix double close of socket when ssl was used ... the race condition closed sporadicaly other socket and caused spurious errors such as these:

Sep 15 17:43:27 foobar monit[2220]: system statistic error -- glob failed: 3 (Bad file descriptor)

Sep 15 22:44:20 foobar monit[2220]: SSH: error receiving identification string -- Bad file descriptor Sep 15 22:44:20 foobar monit[2220]: 'sshd' failed protocol test [SSH] at INET[localhost:22] via TCP

Sep 16 05:01:16 foobar monit[3311]: monit: Error reading pid from file '/var/run/spamd.pid'
Sep 16 05:01:16 foobar monit[3311]: 'spamd' process is not running
Sep 16 05:01:16 foobar monit[3311]: 'spamd' trying to restart
Sep 16 05:01:16 foobar monit[3311]: 'spamd' stop: /etc/init.d/spamassassin
Sep 16 05:01:18 foobar monit[3311]: 'spamd' start: /etc/init.d/spamassassin
Sep 16 05:01:23 foobar monit[3311]: 'spamd' process is running with pid 31357

Sep 16 05:37:48 foobar monit[3311]: md5_stream: stream error -- sum=0, error=0x1 Sep 16 05:37:48 foobar monit[3311]: checksum: file /sbin/ifconfig stream error (0x1) Sep 16 05:37:48 foobar monit[3311]: 'ifconfig' cannot compute checksum for /sbin/ifconfig Sep 16 05:37:49 foobar monit[3311]: 'ifconfig' checksum computed for /sbin/ifconfig

Sep 16 07:58:51 foobar monit[3311]: SMTP: error receiving data -- Bad file descriptor Sep 16 07:58:51 foobar monit[3311]: 'postfix' failed protocol test [SMTP] at INET[localhost:25] via TCP Sep 16 07:58:52 foobar monit[3311]: 'postfix' connection succeeded to INET[localhost:25] via TCP


The new backtrace code shows the problem (note: the shutdown error comes from write shutdown in handle_mmonit and is not error per se):

M/Monit: event message sent to https://1234:443/collector
monit: Socket 3 shutdown failed -- Transport endpoint is not connected
    monit() [0x40f40d]
    monit(LogError+0x9f) [0x40fb5f]
    monit(close_socket+0x84) [0x4129f4]
    monit(close_ssl_socket+0x2e) [0x418dee]
    monit(socket_free+0x88) [0x416e48]
    monit(handle_mmonit+0x1c5) [0x40a675]
    monit() [0x40c775]
    monit(Event_post+0x3d9) [0x40ccc9]
    monit(main+0xa3e) [0x4121de]
    /lib/libc.so.6(__libc_start_main+0xfd) [0x7fcb382b4c4d]
    monit() [0x409d49]
monit: Socket 3 shutdown failed -- Bad file descriptor
    monit() [0x40f40d]
    monit(LogError+0x9f) [0x40fb5f]
    monit(close_socket+0x84) [0x4129f4]
    monit(socket_free+0x3d) [0x416dfd]
    monit(handle_mmonit+0x1c5) [0x40a675]
    monit() [0x40c775]
    monit(Event_post+0x3d9) [0x40ccc9]
    monit(main+0xa3e) [0x4121de]
    /lib/libc.so.6(__libc_start_main+0xfd) [0x7fcb382b4c4d]
    monit() [0x409d49]




http://code.google.com/p/monit/source/detail?r=256

Modified:
 /trunk/CHANGES.txt
 /trunk/socket.c

=======================================
--- /trunk/CHANGES.txt  Thu Sep 16 03:43:18 2010
+++ /trunk/CHANGES.txt  Thu Sep 16 04:49:51 2010
@@ -76,6 +76,8 @@

 * Fixed ICMP echo test on AIX and NETBSD.

+* Fixed sporadic connection failures when SSL sockets were used.
+
* DNS protocol test now accepts request refusal as correct response - the test is based on query for NS root record which may be prohibited on server side, whereas the negative
   response means that the server reacts to requests.
=======================================
--- /trunk/socket.c     Fri Jan  8 03:20:43 2010
+++ /trunk/socket.c     Thu Sep 16 04:49:51 2010
@@ -245,7 +245,7 @@
     } else if((*S)->connection_type==TYPE_ACCEPT && (*S)->sslserver) {
       close_accepted_ssl_socket((*S)->sslserver, (*S)->ssl);
     }
-  }
+  } else
 #endif

   close_socket((*S)->socket);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]