Files
document-haness/docs/clean-architecture-backend-template/tech-log-studio/state-ownership-and-concurrency/case/case-grpc-client-f02.md
T
DongHyeonkaandClaude Opus 5 b2963105a8 docs(keycloak-session-store): import the session-storage lab as a new project
The keycloak project ended with four open questions that design could not
settle. A two-VM lab was built to answer them by measurement, and this is
that material: 26 experiments, 125 raw command outputs, 22 browser captures.

Follows the import procedure in README.md.

  source/     the originating repository verbatim — 78 documents, 28 SVGs,
              8 manifests, plus .source-revision recording the commit
  final/      the SSOT
    document.md   729 lines written from the 29 experiment documents, not
                  concatenated: what was predicted, what was measured, and
                  where the measurement itself was wrong
    evidence/raw    125 outputs, flattened to <experiment>__<file> because
                    the originals collided (01-baseline.txt appeared three
                    times) and the audit only globs the top level
    evidence/meta   one per raw file; command and exitCode are null and the
                    README says why rather than inventing them
    evidence/browser  22 captures
    assets/       three diagrams through techviz
    .techviz/     their VizSpecs

A separate project rather than an addition to keycloak: the B-layer answers
that project's four questions, but the A, C and D layers are about cluster
failure, SSO and operations, and one document.md should hold one subject.
The four question records there can point here through 관계.

Recorded rather than papered over: only three of the 28 diagrams were
remade. The repository forbids hand-drawn SVG and forbids titles inside the
canvas; all 28 originals carry both, so converting them is redrawing, not
reformatting. They stay in source/ and the gap is written into the document.

verify-pipeline.py passes. audit-records.py reports no issues.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-04 22:51:59 +09:00

3.7 KiB

kind, slug, title, topic, project, status, sourceRevision, rootTreeNode, evidenceCapturedOn, assets, evidence, source, module, priority
kind slug title topic project status sourceRevision rootTreeNode evidenceCapturedOn assets evidence source module priority
CASE grpc-client-f02 비원자적 감소가 세대를 영구히 회수 불가로 만든다 state-ownership-and-concurrency clean-architecture-backend-template 게시 전 21234e38cdb9a926cbc92bb97a2aee2e4a7d2916 case:grpc-client-f02 2026-09-01
key file
grpc-client-f02 ../../../final/evidence/rendered/grpc-client-f02.svg
key file
grpc-client-f02-diagram ../../../final/assets/diagrams/grpc-client-f02.svg
../../../final/evidence/raw/grpc-client-f02.txt
원본 분석 절은 analysis/grpc/grpc-client.md#L149 이다.
grpc-client P2

비원자적 감소가 세대를 영구히 회수 불가로 만든다

카운터가 1 일 때 두 스레드가 동시에 끝나면 둘 다 조건을 통과해 둘 다 감소시켜 −1 이 된다. 그 결과가 이 리프에서는 구체적이다.

문제

카운터가 1 일 때 두 스레드가 동시에 끝나면 둘 다 조건을 통과해 둘 다 감소시켜 −1 이 된다.

그 결과가 이 리프에서는 구체적이다.

결론

정확히 0 을 요구한다.

음수가 되면 조용해짐 판정이 영원히 거짓이고, retireQuiescent 가 그 세대를 결코 제거하지 않는다.

회전이 반복될수록 draining 목록이 자란다.

같은 형태가 이 가족의 다른 두 곳에도 있다(GrpcAdmissionController.release, GrpcStreamAdmission.release).

그쪽은 경계가 느슨해지는 결과였고, 이쪽은 자원이 회수되지 않는 결과다.

수정은 updateAndGet(v -> Math.max(0, v - 1)) 이나 decrementAndGet() 후 하한 보정이다.

같은 가족의 GrpcRetryBudget 이 정확한 비교 후 교체 루프를 이미 쓴다.

검증 환경

OpenJDK : 21.0.12 java -version 으로 확인 Gradle : 9.0.0 src/gradle/wrapper/gradle-wrapper.properties 의 distributionUrl 로 확인 확인 방식 : GrpcAdmissionController 참조 16건 검색과 감소 연산의 원자성 확인 소스 수정 : x

재현 조건

원문은 analysis/grpc/grpc-client.md#L149 에 있다.

본문

카운터가 1 일 때 두 스레드가 동시에 끝나면 둘 다 조건을 통과해 둘 다 감소시켜 −1 이 된다.

회수가 막히는 자리

:::evidence key="grpc-client-f02-diagram" alt="비원자적 감소에서 계수기 음수로 둘 다 통과가 건너가고 계수기 음수에서 회수 불가로 조용함 거짓이 건너간다" caption="회수가 막히는 자리" zoom="false" :::

조용해짐 판정이 정확히 0 을 요구하므로, 음수가 되면 그 판정이 영원히 거짓이고 retireQuiescent 가 그 세대를 결코 제거하지 않는다. 회전이 반복될수록 draining 목록이 자란다.

GrpcAdmissionController 참조 위치

:::evidence key="grpc-client-f02" alt="코드베이스에서 GrpcAdmissionController 를 검색한 출력 16줄. 이 기록이 세는 참조가 그 출력에 그대로 보인다." caption="GrpcAdmissionController 코드베이스 검색 — 16줄 · exit 0" zoom="true" :::

같은 형태가 이 가족의 다른 두 곳에도 있다

GrpcAdmissionController.release, GrpcStreamAdmission.release. 그쪽은 경계가 느슨해지는 결과였고, 이쪽은 자원이 회수되지 않는 결과다. 수정은 updateAndGet(v -> Math.max(0, v - 1)) 이나 decrementAndGet() 후 하한 보정이다 — 같은 가족의 GrpcRetryBudget 이 정확한 비교 후 교체 루프를 이미 쓴다.

확인하지 못한 것

동시 해제를 실행으로 재현해 계수기가 음수가 되는 것을 관측하지 않았다. 원자성 분석으로 판정했다.