Live data from Hacker News

Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

windowslatest.com

11–20 of 33 posts

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#11
post #6

On Linux if a file can't be edited because some process is holding it open you can just mv the file to /tmp and create a new file in its place. The process that has it open is unaffected because the handle is independent of the path. On Windows a file that is open in an application cannot be moved, plus it won't tell you which process has it open. Yes you can use some sysinternals tool but this is basic info that sho…

I seem to remember that you could, however, rename the file for a similar effect on Windows.

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#12

For most here, I don't think this article contains new information. The actual interesting discussion, to me, is why Microsoft won't show WHO is dangling the handle open when the user tries to interact with a file via Windows' UI. To understand that, we have to look at a BSOD change Microsoft made in Windows 8: In Windows 2K, XP, Vista, and 7 the BSOD would tell you exactly WHO was causing your BSOD (i.e. which modul…

I believe it was removed actually because it's not a strong indicator of the real fault, there was an old article on this but could only find this more recent summary https://devblogs.microsoft.com/oldnewthing/20250121-00/?p=11...

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#13
post #6

On Linux if a file can't be edited because some process is holding it open you can just mv the file to /tmp and create a new file in its place. The process that has it open is unaffected because the handle is independent of the path. On Windows a file that is open in an application cannot be moved, plus it won't tell you which process has it open. Yes you can use some sysinternals tool but this is basic info that sho…

> because the handle is independent of the path. This makes me wonder, what happens [EDIT: on Windows] when a program uses a file, which more than a single hardlink points to, and you want to remove one of them. Does it matter, through which hardlink the file gets opened or are all the hardlinks prevented from being unlinked?

On Linux you can delete all hardlinks to open files.

What you can't do is modify a file that's executing (program or library), then you get ETXTBSY.

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#14

For most here, I don't think this article contains new information. The actual interesting discussion, to me, is why Microsoft won't show WHO is dangling the handle open when the user tries to interact with a file via Windows' UI. To understand that, we have to look at a BSOD change Microsoft made in Windows 8: In Windows 2K, XP, Vista, and 7 the BSOD would tell you exactly WHO was causing your BSOD (i.e. which modul…

[deleted]

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#15
post #11
post #6

On Linux if a file can't be edited because some process is holding it open you can just mv the file to /tmp and create a new file in its place. The process that has it open is unaffected because the handle is independent of the path. On Windows a file that is open in an application cannot be moved, plus it won't tell you which process has it open. Yes you can use some sysinternals tool but this is basic info that sho…

I seem to remember that you could, however, rename the file for a similar effect on Windows.

No, you can't rename a file in use, unless it is explicitly opened with a sharing flag (which most applications don't).

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#16
post #6

On Linux if a file can't be edited because some process is holding it open you can just mv the file to /tmp and create a new file in its place. The process that has it open is unaffected because the handle is independent of the path. On Windows a file that is open in an application cannot be moved, plus it won't tell you which process has it open. Yes you can use some sysinternals tool but this is basic info that sho…

> because the handle is independent of the path. This makes me wonder, what happens [EDIT: on Windows] when a program uses a file, which more than a single hardlink points to, and you want to remove one of them. Does it matter, through which hardlink the file gets opened or are all the hardlinks prevented from being unlinked?

Hard links are just pointers to the file. You can remove any or all of them independently of each other and the running program. In fact, IIRC there's a semi-common pattern where a program will deliberately create a file, open it, and then unlink it, which leaves it usable but anonymous and in a state that will always be garbage-collected when the program exits.

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#17
post #15
post #11

Earlier quoted context omitted.

I seem to remember that you could, however, rename the file for a similar effect on Windows.

No, you can't rename a file in use, unless it is explicitly opened with a sharing flag (which most applications don't).

I don't know, but that's what the article says Microsoft recommended as a workaround.

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#18
post #11
post #6

On Linux if a file can't be edited because some process is holding it open you can just mv the file to /tmp and create a new file in its place. The process that has it open is unaffected because the handle is independent of the path. On Windows a file that is open in an application cannot be moved, plus it won't tell you which process has it open. Yes you can use some sysinternals tool but this is basic info that sho…

I seem to remember that you could, however, rename the file for a similar effect on Windows.

In windows the shadow copy facility is used to sneak files around when they are open. I remember using a utility called "hobocopy" (a sort of pun on the more famous robocopy) that provided a command line user interface around shadow copy to let you move locked files.

In my specific case it was to save youtube videos when it was still a flash player. the video would be cached in a file but that file would be inaccessible because it was "open" hobocopy to the rescue. On linux it would make then delete the file depending on the open file descriptor to keep it around. The way to save it was to relink another name onto the inode. I can't quite remember but on linux I think you could use a /proc entry to get that inode and on obsd I would use fstat to find it and fsdb to make the relink.

As a unix aficionado I despise windows open file locking with a passion. Sure I understand it is probably more correct, An open file could be in any sort of corrupted state the only safe thing to do is default to single access and locking. But it is far more respectful to the user to just let them grab it whenever they want to. corruption be dammed.

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#19
post #9

For most here, I don't think this article contains new information. The actual interesting discussion, to me, is why Microsoft won't show WHO is dangling the handle open when the user tries to interact with a file via Windows' UI. To understand that, we have to look at a BSOD change Microsoft made in Windows 8: In Windows 2K, XP, Vista, and 7 the BSOD would tell you exactly WHO was causing your BSOD (i.e. which modul…

But the offending module is not necessarily the module listed in the BSOD. It could be a victim too, one that got its memory corrupted by someone else. That's one reason why they removed it, because it was causing end users to blame vendors/MS when they often had nothing to do with whatever the problem was.

That edge case is certainly their official excuse.

Ultimately to determine the underlying root-cause you'd still need to dig this same information out, and all they've done is moved the starting line behind several walls. In essence adding extra work, without solving this edge case/issue.

Regardless of if the information is in the BSOD, Event Log, or only via WinDbg, understanding the information relies on the expertise of the person reviewing/contextualizing it. They've gone out of their way to make contextualizing it harder.

For example, to determine if it is a direct failure or an associative failure (e.g. RAM failing causing different BSODs in unrelated modules), you want that context to be obvious. But without the module being in the Event Logs, you're now loading up half a dozen MiniDumps in WinDbg to find that same very key information - which people may miss or fail to do.

What I am saying is: If we believe that excuse (which I don't), they've done absolutely nothing to address it and just made that same problem worse with their childish games.

Re: Microsoft reveals why Windows 11 keeps saying a file is in use after closing app

#20
“Reveals” is a very strange choice here. Was it previously a secret that they now decided to share? Was it previously unknown and only now discovered?

Really, it’s just an overly fluffy guide for using Sysinternals utilities to help fix the issue. With a heading that is criminally click-baity.

Post reply on HN