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

Process.Start() creates additional process named conhost.exe #110116

Closed
dooann opened this issue Nov 24, 2024 · 3 comments
Closed

Process.Start() creates additional process named conhost.exe #110116

dooann opened this issue Nov 24, 2024 · 3 comments

Comments

@dooann
Copy link

dooann commented Nov 24, 2024

I found that the Process.Start() creates additional process named conhost.exe for each call while the subprocess module in python is not.

Each instance of conhost.exe consumes approximately 5.7 MB of memory, which limits the level of concurrency.

It also affects the pwsh scripts. Actually, I found this issue when writing the pwsh script.

My questions are:

  1. Is conhost.exe necessary for starting a process? If so, why?
  2. Can we remove conhost.exe or provide an option to control its behavior?

Thanks.

var info = new ProcessStartInfo("ping") {
    RedirectStandardOutput = true,
    RedirectStandardError = true,
    UseShellExecute = false,
    CreateNoWindow = true,
    Arguments = "google.com"
};

var process = Process.Start(info);

.Net version: 8.0.401

subprocess.run(['ping', 'google.com'])

Python version: Python 3.12.3

@dooann dooann added the tenet-performance Performance related issue label Nov 24, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Nov 24, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-diagnostics-process
See info in area-owners.md if you want to be subscribed.

@dooann
Copy link
Author

dooann commented Nov 24, 2024

OK. The solution is set CreateNoWindow = false.

Reference: https://stackoverflow.com/questions/53328013/launch-windows-executable-without-conhost

@stephentoub
Copy link
Member

Closing as answered

@stephentoub stephentoub closed this as not planned Won't fix, can't repro, duplicate, stale Nov 24, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants