파싱 워커가 JVM 치명 오류를 정상 실패로 삼키지 않는다 - #947
Merged
Merged
Conversation
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Situation
runCatching으로 감싼다. Kotlin 의runCatching은Exception이 아니라Throwable을 잡으므로 JVM 치명 오류까지 삼킨다.Error는 "이 요청이 실패했다"가 아니라 "이 프로세스로는 더 진행할 수 없다" 는 신호다. 그 신호를 받아 처리하는 층은 이미 바깥에 있다: JVM 의-XX:+ExitOnOutOfMemoryError, 컨테이너 재시작, 배포의 헬스체크와 blue-green 전환. 워커가 삼키면 그 층들이 아무것도 하지 못한다.Task
runCatching으로 바꿔도 그 자리에서 다시 샌다) 회귀를 기계가 막게 한다.Action
포획 범위 좁히기
Exception만 잡는runCatchingException을 만들고 두 워커의runCatching10곳을 전부 교체했다.처음에는 추출 호출만 바꾸려 했으나, 확인해 보니 전이·정체성 기록·원본 삭제까지 같은 문제를 갖고 있었다.
Error는 어느 지점에서 나든 전파돼야 한다는 원칙이 일관되게 서도록 전부 교체했다. 반환 타입을Result로 맞춰 기존onSuccess/onFailure체인은 그대로이고 포획 범위만 좁아진다.재시도 판정에서
Error분기를 제거했다. 이제 도달할 수 없는 분기인데, 남기면 다음 사람이 "여기로Error가 온다"고 읽어 삼키는 설계로 되돌리기 쉽다.전파의 실제 도달점 (실측)
모든
Error가 프로세스를 죽이지는 않는다. 과장하지 않으려고 실측해 주석에 남겼다.ExitOnOutOfMemoryError). 워커에 도달조차 안 함Error@Async라 Spring 의 async 예외 핸들러까지. 커스텀 핸들러가 없어 기본 구현이 ERROR 로그를 남김핵심 이득은 프로세스 종료가 아니라 확정 실패로 오분류되지 않는 것이다. 그 덕에 상태 전이·원본 회수·메트릭 오염이 사라지고, 행은 처리중으로 남아 stale 회수가 되살린다. 박동 레지스트리는
guarded의finally가Error가 지나가도 정리하는 것을 확인했다.회귀 막기
포획 경계를 테스트로 못 박았다.
Exception은 실패 결과로,Error3종(OutOfMemoryError·StackOverflowError·NoClassDefFoundError)은 그대로 전파.여기에 두 워커가 표준
runCatching을 쓰면 실패하는 검사를 더했다. 한 곳만 되돌아가도 그 자리에서 조용히 새는데 리뷰로만 걸러야 하는 종류라, 기계 판정이 가능한 불변식을 결정론 층으로 내렸다. 주석에 이름이 등장하는 것은 위반으로 세지 않는다.기존 기대 두 곳(재시도 판정의
Error케이스, 사유 집계의OutOfMemoryError케이스)은 더 이상 성립하지 않아 제거하고 이유를 주석에 남겼다.Result
runCatching으로 되돌려 검사가 잡는 것을 보고 원복했다.StackOverflowError등 다른Error가 열어둔 경로와, 안전이 코드가 아니라 배포 워크플로의 JVM 플래그에 걸려 있던 구조다. 누군가 메모리 설정을 손보며 그 플래그를 빼면 위험이 조용히 부활하는데, 이제 코드가 스스로 막는다.OutOfMemoryError문자열이 들어 있어 로그 검색에 걸린 것이다.연관 이슈