Live data from Hacker News

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

windowslatest.com

21–30 of 33 posts

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

#21

Earlier quoted context omitted.

> 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.

My question was about Windows, yeah on Linux it obviously doesn't matter, because you can unlink it even if there is only a single hardlink. My bad, I should have written it.

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

Why can't you? Couldn't it do the same thing and just keep it in memory?

Edit: Actually on my system, I can start a program, unlink it and keep using it just fine. I wonder what case you are referring to.

ETXTBSY isn't even descriped in unlink(2), but it is in unlink(3posix): ETXTBSY - The entry to be unlinked is the last directory entry to a pure procedure (shared text) file that is being executed.

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

#22

Earlier quoted context omitted.

> 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.

On Windows you can't remove a file while a program is using it, that's the topic of the post. To me that implies that Windows can't keep a file around without having a hardlink to it. But what happens when there is more than one hardlink? Hence my question.

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

#24

Earlier quoted context omitted.

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.

On Windows you can't remove a file while a program is using it, that's the topic of the post. To me that implies that Windows can't keep a file around without having a hardlink to it. But what happens when there is more than one hardlink? Hence my question.

Oh, on Windows. I have no idea:)

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

#25

Earlier quoted context omitted.

On Windows you can't remove a file while a program is using it, that's the topic of the post. To me that implies that Windows can't keep a file around without having a hardlink to it. But what happens when there is more than one hardlink? Hence my question.

Oh, on Windows. I have no idea:)

Yeah, me neither :-)

At most I use GNU/NT.

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

#27

It feels like the article is repeating information from some other source, but I don’t see such a source linked? (also note that this site is not associated with Microsoft.)

https://www.youtube.com/watch?v=DULHyCygDt4

This is the video this article is based on.

But you're right, source attribution is horrible in this article. And in every other article these days.

It is full of URLs that link to other articles on THAT website, sometimes categories, often these links are auto-generated.

Everything to keep you into their ecosystem, at the cost of quality of journalism.

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

#28
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.

while not root cause, wouldn’t a module having corrupted memory still be an issue with either the OS (for not protecting it) or the module (for not sanitizing input)?

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

#29

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…

"Microsoft Reveals" articles on this site are clickbaity. All this information lives in public docs, and is well known in the industry.

It is cool that Microsoft is writing these blog posts for laypeople, though. And yes, kind of crazy that some of these rough edges in the OS have not been smoothed out yet.

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

#30
post #9

Earlier quoted context omitted.

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.

while not root cause, wouldn’t a module having corrupted memory still be an issue with either the OS (for not protecting it) or the module (for not sanitizing input)?

No, because this would be kernel level code, so anything else running in the kernel (other drivers) could stomp on your memory and you couldn't do anything about it. No OS protections here.
Post reply on HN