dotnet / dotnet/docs

Host shutdown mistakes

Open
#42,655 0 comments 0 reactions 0 assignees View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

### Type of issue

Missing information

### Description

From

![Host shutdown](https://github.com/user-attachments/assets/98c06116-8a1e-4eab-b1f5-0b54b57b54b8)

1. I deem "SIGTERM is also raised" should be "`ProcessExit` is also raised".
2. This appear somewhat melded.

> Since ConsoleLifetime blocked ProcessExit while waiting for the host to shut down, this behavior led to [deadlocks](https://github.com/dotnet/runtime/issues/50397) from Environment.Exit also blocks waiting for the call to ProcessExit.

I went through code and linked issue and I am not 100 % sure but it should be something like:

"`Environment.Exit` fired `ProcessExit` and `ConsoleLifetime` blocked waiting to host stop which in turn was not possible because host was waiting to finish `Environment.Exit`, a [deadlock](https://github.com/dotnet/runtime/issues/50397).".

### Page URL

https://learn.microsoft.com/en-us/dotnet/core/extensions/generic-host?tabs=hostbuilder

### Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/extensions/generic-host.md

### Document Version Independent Id

22a12ff8-d2ff-a841-b9bb-e2fd1032bc04

### Article author

@IEvangelist

### Metadata

* ID: d43ecd7c-307a-688e-d533-c1135bde65f9
* Service: **dotnet-fundamentals**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.