• Carlos Garnacho's avatar
    goutputstream: Check individual close operations after splice · c033450f
    Carlos Garnacho authored
    After a splice operation is finished, it attempts to 1) close input/output
    streams, as per the given flags, and 2) return the operation result (maybe
    an error, too).
    
    However, if the operation gets cancelled early and the streams indirectly
    closed, the splice operation will try to close both descriptors and return
    on the task when both are already closed. The catch here is that getting the
    streams closed under its feet is possible, so the completion callback would
    find both streams closed after returning on the first close operation and
    return the error, but then the second operation could be able to trigger
    a second error which would be returned as well.
    
    What happens here is up to further race conditions, if the task didn't
    return yet, the returned error will be simply replaced (but the old one not
    freed...), if it did already return, it'll result in:
    
    GLib-GIO-FATAL-CRITICAL: g_task_return_error: assertion '!task->ever_returned' failed
    
    Fix this by flagging the close_async() callbacks, and checking that both
    close operations did return, instead of checking that both streams are
    closed by who knows.
    
    This error triggers a semi-frequent CI failure in tracker, see the summary at
    tracker#240
    c033450f