Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows Defender goes nuts when running rustdoc on some projects #36277

Open
Jascha-N opened this issue Sep 5, 2016 · 14 comments
Open

Windows Defender goes nuts when running rustdoc on some projects #36277

Jascha-N opened this issue Sep 5, 2016 · 14 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows Operating system: Windows T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@Jascha-N
Copy link

Jascha-N commented Sep 5, 2016

rustdoc gets pretty much completely stalled on some projects by Windows Defender on Windows 10. rustdoc cpu usage drops to 0%, while MsMpEng.exe uses 100% on a single core. This issue seems to have popped up only a few weeks ago.

@retep998
Copy link
Member

retep998 commented Sep 5, 2016

rustdoc is creating thousands of files. Windows defender has to intercept each one and check whether it is okay. My recommended solution is to add the folder where you do all your rust dev to the windows defender exceptions.

As for why the issue popped up recently, it could be that rustdoc's filesystem access patterns have changed in a way that hits a pathological edge case of Defender.

@Jascha-N
Copy link
Author

Jascha-N commented Sep 5, 2016

I understand and that is what I do for now. However, since cargo pulls in and compiles external crates in a subfolder of that same folder, it doesn't seem that safe. And adding exceptions for every target/.../doc folder for every project, profile and target is a complete hassle. As I've said, I've only seen this happen in the past few weeks, but that could be on me. It could very well be that I hadn't noticed it before. Thanks for the quick response.

@emidoots
Copy link

emidoots commented Sep 5, 2016

I googled a bit out of curiosity. It looks like you can submit false positives here: https://www.microsoft.com/en-us/security/portal/submission/submit.aspx

Maybe that would resolve the issue?

@retep998
Copy link
Member

retep998 commented Sep 5, 2016

@slimsag There's no false positives here. This is simply Windows Defender slowing things down dramatically by checking files produced by rustdoc.

@emidoots
Copy link

emidoots commented Sep 5, 2016

You're totally right. My apologies -- I misread.

On Sep 5, 2016 1:52 AM, "Peter Atashian" notifications@github.com wrote:

@slimsag https://github.com/slimsag There's no false positives here.
This is simply Windows Defender slowing things down dramatically by
checking files produced by rustdoc.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#36277 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADBrOFRsUJdHZ1wStKYOQPNLeDSaSrLcks5qm9hggaJpZM4J0xvc
.

@alexcrichton alexcrichton added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Sep 6, 2016
@steveklabnik steveklabnik added T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. and removed T-tools labels May 18, 2017
@Mark-Simulacrum Mark-Simulacrum added C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows Operating system: Windows labels Jul 26, 2017
@Boscop
Copy link

Boscop commented Jul 23, 2018

For anyone who's interested, these are my Rust related Windows Defender excluded processes:

image

@kzys
Copy link
Contributor

kzys commented Sep 28, 2018

Can you reproduce the issue still? To be honest, I think rustdoc can't do much about the issue. It has to create a lot of files...

@Boscop
Copy link

Boscop commented Sep 28, 2018

@kzys What can be done is to make docs optional again: rust-lang/rustup#998
And it should be done IMO, to make updating nightlies much faster and because space is limited on Raspberry Pi.
I never used the installed docs anyway, always the online docs.
It's required to have an internet connection anyway to be able to use cargo..

@kzys
Copy link
Contributor

kzys commented Sep 29, 2018

In that case, cargo, rustup, or both of them should have the option to not install docs. Rustdoc itself can't do much.

@retep998
Copy link
Member

The real solution here is for rustdoc to stop creating so many files! Come up with ways to merge multiple items into a single html file, so crates like winapi don't take literal hours to document.

@Boscop
Copy link

Boscop commented Nov 13, 2018

Sorry if this is too off-topic: How can I exclude ALL nightlies from causing Windows Defender to scan the files they create? I.E. all exe files under D:\Program Files\.multirust\toolchains.
It seems I can only add individual .exe files under "Excluded processes" and I can only enter directories for "Excluded files and locations" but when I add D:\Program Files\.multirust\toolchains to that category, it will only not scan the contents of that dir, but still the files created by exes in that dir!

I found this answer:
https://www.reddit.com/r/Windows10/comments/5gf38v/when_excluding_a_process_in_windows_defender_do_i/day7lz6/
But it doesn't seem to work on Win 8.1:

image

@retep998
Do you have an idea how to exclude all installed nightlies from Windows Defender (the files they create) on Win 8.1?

@steveklabnik
Copy link
Member

@Boscop help questions are best posed on users.rust-lang.org

@ehuss ehuss removed the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jan 18, 2022
@jieyouxu
Copy link
Member

jieyouxu commented Mar 16, 2025

Triage: this is really late (like 6 years later), but current Windows dev recommendations would be to setup a Dev Drive on a sufficiently recent Windows 11 (possible even with ReFS). For dev drive, Windows defender will change its default to be performance mode.

But only do that if you can trust the deps / build process / produced artifacts (standard development safety practices apply).

I don't think this is very actionable for rustdoc atm.

@jieyouxu jieyouxu added C-external-bug Category: issue that is caused by bugs in software beyond our control C-enhancement Category: An issue proposing an enhancement or a PR with one. and removed C-enhancement Category: An issue proposing an enhancement or a PR with one. C-external-bug Category: issue that is caused by bugs in software beyond our control labels Mar 16, 2025
@retep998
Copy link
Member

The only actionable thing that rustdoc can do here is as I mentioned before: reducing the number of files that are created. Granted, that is a significant undertaking that would involve a drastically different documentation format, so it's not an easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. O-windows Operating system: Windows T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

10 participants