> On 6 Sep 2017, at 15:38, jn...@jnthn.net via RT > <perl6-bugs-follo...@perl.org> wrote: > To recap the IRC discussion yesterday: no, we haven't had this so far (except > for stdout/stderr), and have gotten away with it due to the lack of output > buffering. At present, we can either choose between: > > 1) Start keeping a list of open files, and at exit close them (flushing is > already part of closing). This can be done at Perl 6 level, in the same place > we make sure to run END blocks. > > 2) Having unclosed handles possible to GC, and closing them if/when they get > GC'd. > > Today we are doing #2. We could switch to doing #1. We can't currently do > both, because the moment we start keeping a list of open handles then they > can't be GC'd, and so #2 can't happen. > > My initial inclination was to preserve behavior #2, though others have > pointed out that behavior #1 is more useful for debugging in that it ensures > log files, for example, will be written in the event of a crash, and a > program relying on behavior #2 could already run out of handles today anyway > if it were less lucky with GC timing. This is a fair argument, and the > automatic close at exit might be softer on the ecosystem too (but would have > done nothing for the Text::CSV case, which is the original subject of this > ticket, because it wrote a file, didn't close it, then separately opened it > for reading). > > There's probably enough consensus to switch to option #1, and lizmat++ > mentioned maybe looking into a patch to do that.
FWIW, I have a patch, but it causes t/spec/S32-io/lock.t to hang in test #6. Trying to find out what is going on there right now. Liz