Summary#
Graceful teardown must own descendant processes and pending async work
Problem#
External GitHub PRs showed shutdown bugs when wrappers, PTY layers, or destructors assumed children and pending operations would stop themselves. That led to stuck shutdowns, orphaned work, or duplicate interrupts.
Solution#
Track the real process tree or pending-operation queue, then shut down in the correct ownership order: signal the effective child, drain pending operations before subsystem teardown, and keep platform-specific paths explicit. Add regression tests that simulate wrapper processes and delayed cleanup.
Failure Modes#
- Nested child processes survive after the parent exits
- Duplicate SIGINT delivery causes noisy or unsafe shutdown
- Destructor runs after required backend state is already gone
- Global worker threads keep binaries from exiting cleanly
Sources#
- https://github.com/tensorflow/tensorflow/pull/121411
- https://github.com/tensorflow/tensorflow/pull/121372
- https://github.com/tensorflow/tensorflow/pull/120325
- https://github.com/tensorflow/tensorflow/pull/121417
- https://github.com/tensorflow/tensorflow/pull/121265
- https://github.com/tensorflow/tensorflow/pull/121448
- https://github.com/tensorflow/tensorflow/pull/121421
- https://github.com/tensorflow/tensorflow/pull/121418
- https://github.com/tensorflow/tensorflow/pull/121453
- https://github.com/tensorflow/tensorflow/pull/121444
- https://github.com/huggingface/transformers/pull/46039
- https://github.com/huggingface/transformers/pull/46698
- https://github.com/huggingface/transformers/pull/46523
- https://github.com/huggingface/transformers/pull/46721
- https://github.com/huggingface/transformers/pull/46619
- https://github.com/huggingface/transformers/pull/46587
- https://github.com/huggingface/transformers/pull/46472
- https://github.com/huggingface/transformers/pull/46720
- https://github.com/huggingface/transformers/pull/46600
- https://github.com/huggingface/transformers/pull/46690
- https://github.com/huggingface/transformers/pull/46618
- https://github.com/microsoft/ML-For-Beginners/pull/978
- https://github.com/microsoft/ML-For-Beginners/pull/971
- https://github.com/microsoft/ML-For-Beginners/pull/967
- https://github.com/microsoft/ML-For-Beginners/pull/970
- https://github.com/ClickHouse/ClickHouse/pull/107755
- https://github.com/ClickHouse/ClickHouse/pull/107355
- https://github.com/ClickHouse/ClickHouse/pull/107291
- https://github.com/ClickHouse/ClickHouse/pull/107513
- https://github.com/ClickHouse/ClickHouse/pull/106957
- https://github.com/ClickHouse/ClickHouse/pull/100500
- https://github.com/ClickHouse/ClickHouse/pull/107625
- https://github.com/ClickHouse/ClickHouse/pull/107624
- https://github.com/ClickHouse/ClickHouse/pull/102064
- https://github.com/ClickHouse/ClickHouse/pull/105943
- https://github.com/ClickHouse/ClickHouse/pull/107704
- https://github.com/ClickHouse/ClickHouse/pull/107731
- https://github.com/ClickHouse/ClickHouse/pull/107729
- https://github.com/ClickHouse/ClickHouse/pull/102942
- https://github.com/vercel/turborepo/pull/13100
- https://github.com/vercel/turborepo/pull/13098
- https://github.com/vercel/turborepo/pull/13095
- https://github.com/vercel/turborepo/pull/13094
- https://github.com/vercel/turborepo/pull/13093
- https://github.com/vercel/turborepo/pull/13092
- https://github.com/vercel/turborepo/pull/13090
- https://github.com/vercel/turborepo/pull/13089
- https://github.com/vercel/turborepo/pull/13088
- https://github.com/vercel/turborepo/pull/13086
- https://github.com/vercel/turborepo/pull/13085
- https://github.com/vercel/turborepo/pull/13084
- https://github.com/vercel/turborepo/pull/13079
- https://github.com/vercel/turborepo/pull/13077
- https://github.com/vercel/turborepo/pull/13074
- mined_at: 2026-06-17T16:08:52Z
Sagwan Revalidation 2026-06-17T16:14:18Z#
- verdict:
ok - note: 프로세스 트리와 pending 작업을 명시적으로 정리하라는 권장은 여전히 유효함
Sagwan Revalidation 2026-06-18T17:00:56Z#
- verdict:
ok - note: 전날 검증 이후 일반 원칙·권장안·출처 모두 재사용 가능해 보임
Sagwan Revalidation 2026-06-19T18:29:32Z#
- verdict:
ok - note: 전날 검증 이후 변동 여지 적고 teardown 원칙도 최신 관행과 부합함
Sagwan Revalidation 2026-06-20T18:46:20Z#
- verdict:
ok - note: 전날 검증 이후 원칙·권장안의 유효성을 흔들 변화 징후가 없음.
Sagwan Revalidation 2026-06-21T20:22:01Z#
- verdict:
ok - note: 일반 원칙과 권장안이 최신 실무와 맞으며 재사용 가능함
Sagwan Revalidation 2026-06-22T20:37:35Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-06-23T20:59:15Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-06-24T21:19:10Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-06-25T21:55:32Z#
- verdict:
ok - note: 종료 시 하위 프로세스와 비동기 작업 소유권을 명확히 하라는 원칙은 여전히 유효함
Sagwan Revalidation 2026-06-27T03:33:09Z#
- verdict:
ok - note: 최근 검증 이후 변화 가능성이 낮고 원칙도 여전히 재사용 가능함
Sagwan Revalidation 2026-06-28T04:57:45Z#
- verdict:
ok - note: 원칙 중심 내용이고 전일 검증 이후 변경 징후가 없어 재사용 가능.
Sagwan Revalidation 2026-06-29T05:18:40Z#
- verdict:
ok - note: 일반 원칙과 권장안은 최신 teardown practice와 여전히 부합함
Sagwan Revalidation 2026-06-30T06:30:29Z#
- verdict:
ok - note: 일반 원칙과 권장안이 최신 practice와 맞아 변경 필요가 작다.
Sagwan Revalidation 2026-07-01T13:01:02Z#
- verdict:
ok - note: 전날 검증 이후 바뀔 만한 구체 수치가 없고 teardown 원칙도 여전히 유효함
Sagwan Revalidation 2026-07-03T02:10:33Z#
- verdict:
ok - note: 원칙성 캡슐이며 최근 검증 이후 낡을 만한 수치·권장 변화가 없음
Sagwan Revalidation 2026-07-04T13:11:30Z#
- verdict:
ok - note: 종료 소유권·대기 작업 정리 원칙은 현재 practice와도 부합한다.
Sagwan Revalidation 2026-07-05T15:07:29Z#
- verdict:
ok - note: 일반 원칙 중심이라 수치·권장안 변화 위험이 낮고 재사용 가능함
Sagwan Revalidation 2026-07-06T21:55:58Z#
- verdict:
ok - note: 일반 원칙과 권장안이 현재 practice와 충돌하지 않습니다.
Sagwan Revalidation 2026-07-08T04:06:08Z#
- verdict:
ok - note: 종료 시 하위 프로세스와 비동기 작업을 소유·정리해야 한다는 원칙은 여전히 유효함
Sagwan Revalidation 2026-07-10T02:58:56Z#
- verdict:
ok - note: 원칙성 캡슐이며 이전 검증 후 이틀뿐이라 재사용 가능함
Sagwan Revalidation 2026-07-11T20:36:20Z#
- verdict:
ok - note: 프로세스 트리와 pending 작업 소유권 원칙은 여전히 최신 관행에 부합함
Sagwan Revalidation 2026-07-13T15:40:14Z#
- verdict:
ok - note: 일반 원칙과 권장안이 여전히 유효하며 최근 검증 이후 변화 근거 없음
Sagwan Revalidation 2026-07-15T14:49:30Z#
- verdict:
ok - note: 일반적 teardown 원칙으로 최근 관행과 충돌 없이 재사용 가능함
Sagwan Revalidation 2026-07-17T15:30:59Z#
- verdict:
ok - note: 일반 원칙과 권장안이 현재도 유효하며 갱신 필요성이 낮음
Sagwan Revalidation 2026-07-19T16:49:36Z#
- verdict:
ok - note: 종료 시 하위 프로세스와 대기 작업을 소유·정리하라는 권장안은 여전히 유효함
Sagwan Revalidation 2026-07-21T17:59:32Z#
- verdict:
ok - note: 일반적 teardown 원칙과 사례 링크가 최근 검증 이후 여전히 재사용 가능함
Sagwan Revalidation 2026-07-23T19:41:44Z#
- verdict:
ok - note: 일반적 종료 소유권 원칙과 권장안은 최근 practice와도 일치함
Sagwan Revalidation 2026-07-25T21:54:54Z#
- verdict:
ok - note: 종료 소유권과 비동기 drain 원칙은 현재 practice와도 부합함
Sagwan Revalidation 2026-07-28T04:23:36Z#
- verdict:
ok - note: 일반적 종료 소유권 원칙으로 최근 관행과 충돌 없어 재사용 가능
Sagwan Revalidation 2026-07-30T09:16:17Z#
- verdict:
ok - note: 일반 원칙 중심이며 최근 검증 이후 낡은 수치·권장 변화가 보이지 않음
Sagwan Revalidation 2026-08-01T19:23:13Z#
- verdict:
ok - note: 일반 원칙과 권장안이 현재 관행과 맞아 변경 필요가 작다.
Sagwan Revalidation 2026-08-04T09:00:22Z#
- verdict:
ok - note: 최근 검증 이후 변화 가능성 낮고 권장안도 현재 관행과 부합함
Sagwan Revalidation 2026-08-08T05:07:51Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-10T16:49:57Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-13T05:11:53Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-15T17:36:15Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-18T05:36:09Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-20T17:59:41Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-23T07:06:51Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-25T19:04:12Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-28T07:49:39Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-08-30T19:47:12Z#
- verdict:
ok - note: [chatgpt HTTP 401] {
Sagwan Revalidation 2026-09-02T09:48:56Z#
- verdict:
ok - note: 프로세스 트리와 pending 작업을 명시적으로 정리하는 원칙은 여전히 유효함
Sagwan Revalidation 2026-09-08T12:29:02Z#
- verdict:
ok - note: 일반 원칙과 권장안이 여전히 최신 관행에 부합하며 수정 필요 없음
Sagwan Revalidation 2026-09-11T01:49:05Z#
- verdict:
ok - note: 원칙형 권장안으로 최신 종료 처리 관행과 충돌 없고 수치 의존도 낮음
Sagwan Revalidation 2026-09-13T21:58:36Z#
- verdict:
ok - note: 프로세스 트리 소유권·비동기 drain 순서 원칙은 플랫폼 무관한 불변 패턴이며 최신 관행과 일치한다.