--- kind: CONCEPT slug: adapter-outbound-httpclient-c02 title: 회전이 틈으로 관측되지 않게 만든 순서와 두 누수 이력 topic: state-machines-and-ownership project: clean-architecture-backend-template status: 게시 전 sourceRevision: 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 rootTreeNode: concept:adapter-outbound-httpclient-c02 evidenceCapturedOn: 2026-09-01 assets: - key: adapter-outbound-httpclient-c02 file: ../../../final/evidence/rendered/adapter-outbound-httpclient-c02.svg evidence: - ../../../final/evidence/raw/adapter-outbound-httpclient-c02.txt source: - 원본 분석 절은 analysis/11-adapter-outbound-httpclient.md#L112 이다. module: adapter-outbound-httpclient --- # 회전이 틈으로 관측되지 않게 만든 순서와 두 누수 이력 `ClientRuntimeRegistry`는 교체본을 먼저 발행하고 이전 세대를 나중에 드레인한다. 과거 누수 두 건이 코드와 주석에 남아 있다. ## 본문 "A swap publishes the replacement first and drains the predecessor afterwards, so a rotation is never observable as a gap." `acquire`는 관측한 세대가 예약 직전에 draining으로 넘어가면 **새로 발행된 세대에 대해 재시도**한다. ## ClientRuntimeRegistry 참조 위치 :::evidence key="adapter-outbound-httpclient-c02" alt="코드베이스에서 ClientRuntimeRegistry 를 검색한 출력 24줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="ClientRuntimeRegistry 코드베이스 검색 — 24줄 · exit 0" zoom="true" ::: ## 아무도 열거하지 않아서 보이지 않던 누수 교체된 세대가 `runtimes`에서 빠지고 스케줄된 drain 작업만 소유하게 되어, 그 작업이 발화하기 전에 레지스트리가 닫히면 "leaked the whole generation — and the resource-bound suite could not see it, because nothing enumerated it." 지금은 `retired` 집합이 추적한다. ## 실패가 클수록 더 많이 새던 종료 `close()`가 `forEach`로 닫다가 첫 예외에서 멈춰 "a single misbehaving pool left every remaining connection, thread and socket open — **shutdown leaked more the worse the failure was.**" 지금은 전부 닫고 실패를 suppressed로 모은다.