[collectd-changes] collectd, the system statistics collection daemon: Changes to 'collectd-4.7'

Florian Forster octo at verplant.org
Wed Sep 30 22:58:55 CEST 2009


 src/unixsock.c |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

New commits:
commit 5b5fff5bbdc5515d7f4c2a01df47373f4ac44847
Author: Florian Forster <octo at huhu.verplant.org>
Date:   Wed Sep 30 22:49:16 2009 +0200

    unixsock plugin: Fix a (well hidden) race condition.
    
    Within the client handling thread, fdopen is called twice on the file
    descriptor passed to the thread. Later those file handles are closed like:
    
      fclose (fhin);
      fclose (fhout);
    
    This is a race condition, because the first call to fclose will close the file
    descriptor. The second call to fclose will try the same. Usually, it would fail
    silently and all is well. On a busy machine, however, another thread may just
    have opened a file or accepted a socket. In that case an arbitrary file
    descriptor is closed. If the file descriptor is opened yet again fast enough,
    data may even end up in a totally wrong location.
    
    As a work-around the file descriptor is not dup'ed so each fdopen operates on
    its own file descriptor. As an alternative the "r+" mode and a single file
    handle may be suitable, too.
    
    Many thanks to Sven Trenkel for pointing me into the right directioin :)




More information about the collectd-changes mailing list