Skip to main content
9 events
when toggle format what by license comment
Jul 1, 2019 at 11:03 comment added Ilmari Karonen @DrunkenCodeMonkey: The pattern is open-delete-work-close. If the program is still doing something with the contents of the temporary file (e.g. using it as an on-disk cache, or logging telemetry data into it), then of course it must keep it open. (Of course, it's also possible that this is indeed a stale unclosed file handle that the program should've closed but didn't. But given that there's only one such file, and that there are no other obvious indications of a resource leak, I would start with the assumption that the file is probably being kept open on purpose.)
Jul 1, 2019 at 10:19 comment added Drunken Code Monkey Hence why I specified there may be a rationale for keeping it open in my first comment, but if there is it should be clearly defined.
Jul 1, 2019 at 10:07 comment added leftaroundabout @DrunkenCodeMonkey so, what if the program is never done with it?
Jul 1, 2019 at 9:39 comment added Drunken Code Monkey Open-delete-close is fine, what is wrong is open-delete and then keep the handle open until the process terminates. This is NOT normal behavior for any program. A handle should be freed as soon as the program is done with it.
Jul 1, 2019 at 8:51 comment added Toby Speight This doesn't account for the discrepancy seen using df (which simply counts used blocks, and takes no account of link count or anything to do with names)
Jul 1, 2019 at 8:09 comment added Mark @DrunkenCodeMonkey, a great many well-written programs do this. The open-delete-close pattern for creating temporary files on *nix is nearly universal, because it guarantees the file will be deleted when the program exits, regardless of how it exits: normal termination, crashing, killed by running out of memory, killed by power failure, etc.
Jun 30, 2019 at 3:28 comment added Criggie @DrunkenCodeMonkey Dude - its Chrome... you're totally correct.
Jun 30, 2019 at 1:19 comment added Drunken Code Monkey Most well-written programs should not do this. It's a bug, and should be reported, it's just that most of these obscure bugs don't really show up until you are in an optimization phase, and if it's a one off it may even not really be detected at all during testing. Note that there may be a specific reason why they are doing this, there may be a rationale I am not aware of here for keeping the handle open this long.
Jun 29, 2019 at 22:47 history answered Criggie CC BY-SA 4.0