• MySQL Build Team's avatar
    Backport into build-201102032246-5.1.52sp1 · 436b67e3
    MySQL Build Team authored
    > ------------------------------------------------------------
    > revno: 3536
    > revision-id: davi.arnaut@oracle.com-20110107183336-kp8niwm2hz3wb4c3
    > parent: saikumar.v@sun.com-20110106103945-rhsek9uy6f63db44
    > committer: Davi Arnaut <davi.arnaut@oracle.com>
    > branch nick: 51023-5.1
    > timestamp: Fri 2011-01-07 16:33:36 -0200
    > message:
    >   Bug#51023: Mysql server crashes on SIGHUP and destroys InnoDB files
    >   
    >   From a user perspective, the problem is that a FLUSH LOGS or SIGHUP
    >   signal could end up associating the stdout and stderr to random
    >   files. In the case of this bug report, the streams would end up
    >   associated to InnoDB ibd files.
    >   
    >   The freopen(3) function is not thread-safe on FreeBSD. What this
    >   means is that if another thread calls open(2) during freopen()
    >   is executing that another thread's fd returned by open(2) may get
    >   re-associated with the file being passed to freopen(3). See FreeBSD
    >   PR number 79887 for reference:
    >   
    >     http://www.freebsd.org/cgi/query-pr.cgi?pr=79887
    >   
    >   This problem is worked around by substituting a internal hook within
    >   the FILE structure. This avoids the loss of atomicity by not having
    >   the original fd closed before its duplicated.
    >   
    >   Patch based on the original work by Vasil Dimov.
    436b67e3
my_fopen.c 8.7 KB