You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
colcontainer: harden closing of files in diskQueue
The AI review of 31c3419 pointed out
that `io.Closer` interface is such that calling `Close` multiple times
can result in an undefined behavior. Previously, we had multiple places
where if we got an error on the first `Close` call of read or write file
of the disk queue, we could try to close the same file again - this was
the case since we nil-ed out the file pointer after the error
short-circuiting logic. This commit hardens the disk queue around this
error to guarantee that we always close the file exactly once. This also
allows us to remove some of explicit nilling out logic which now became
redundant.
It's not immediately clear to me what actual "undefined behavior" would
be in case of double-`Close` (or if it's even possible for
implementations that we use to return an error), so I didn't include
a release note. Still, it seems prudent to follow the interface's
contract.
Release note: None
0 commit comments