On Fri Jul 14 20:24:27 2023 +0000, Paul Gofman wrote:
Yes, it might be interesting, but do you think it is strictly related to this patchset? Reproducing that for other objects types and fixing those is a lot more than this patchset was intended to do. Unless you think that if e. g., named pipes needs the same this part (which is only a few lines in the socket specific part) this should be done some way entirely different? Just e. g., there are also other thing which tests here uncovered, that async cancelation with completion (and some other conditions) doesn't update IO status until removing completion. Meaning if we do that without removing completion when Windows doesn't we might be accessing the already free memory. We can't fix everything at once.
Well, if it applies to all file types, it suggests that we may want to fix this in the caller to close_handle(), so yes, there would be a relatively simple way to fix it for all file types. There's not quite precedent for that, but I think it wouldn't be unreasonable.
Perhaps more saliently, though, if the condition for termination is "all process handles are closed and the thread is terminated", well... we're handling that in two places, based on which condition happens first, but in one case we're being agnostic as to the file type and in the other place we're not. That decidedly doesn't look right.