• Nils Goroll's avatar
    Fix and radically simplify logbuffer_wait_flush_fini() · c1dbbbf2
    Nils Goroll authored
    The dance of taking a reference when waiting caused a lot of trouble
    already before, and with a fresh look at it does not seem to make much
    sense. But most importantly, it was wrong:
    
    lbuf->ff was set to NULL in logbuffer_flush_finish_work_one() before
    the mutex was returned with pthread_cond_wait(), so
    
    	if (ff == NULL)
    		goto unlock;
    
    in logbuffer_wait_flush_fini() could lead to the function returning
    before logbuffer_flush_finish_work_one() _was_ actually done.
    
    But with bceec122 this could lead
    to the stack memory being repurposed (logbuffer_flush_finish
    returning) before it was actually safe to.
    
    This issue could surface in fellow_log_test hanging.
    
    We also now return all allocations under the lock to prevent a race
    with fellow_log_close() where flush finish threads could outlive the
    ffd, resulting in buddy leak detection to fire, because the ff
    allocation was not returned.
    
    Fixes #49
    c1dbbbf2
Name
Last commit
Last update
LICENSES Loading commit data...
logs Loading commit data...
src Loading commit data...
.gitignore Loading commit data...
BUGS.rst Loading commit data...
CHANGES.rst Loading commit data...
COPYING Loading commit data...
INSTALL.rst Loading commit data...
Makefile.am Loading commit data...
README.rst Loading commit data...
bootstrap Loading commit data...
configure.ac Loading commit data...