Skip to content

[Fix] - 배포 안정성 강화: 에러 핸들러 연쇄 장애 방지#180

Merged
thingineeer merged 1 commit intodevfrom
fix/health-data-stability
Feb 23, 2026
Merged

[Fix] - 배포 안정성 강화: 에러 핸들러 연쇄 장애 방지#180
thingineeer merged 1 commit intodevfrom
fix/health-data-stability

Conversation

@thingineeer
Copy link
Contributor

Summary

  • ControllerExceptionAdvice: Slack/Sentry 호출을 try-catch로 감싸서 에러 핸들러 자체가 터지는 연쇄 장애 방지
  • SlackApi: StringBuilder 인스턴스 변수 → 지역 변수 (스레드 안전), 빈 스택트레이스 방어
  • RecordService: 건강 데이터 조회 실패해도 기록 목록은 정상 반환

원인 분석

건강 데이터 테이블 쿼리 실패 → ControllerExceptionAdvice.handleException()에서 SlackApi.sendAlert() 호출 → sendAlert도 실패 (throws IOException 전파) → Spring 기본 500 포맷 반환 → 모든 500 에러가 연쇄적으로 깨짐

방어 포인트

  1. 에러 핸들러 절대 안 터짐: Slack/Sentry 실패해도 ApiResponseDto 정상 반환
  2. 기존 기능 절대 안 깨짐: health data 조회 실패해도 record 목록은 정상
  3. 스레드 안전: SlackApi의 공유 StringBuilder 제거

Test plan

  • /api/record 정상 응답 확인
  • /api/auth 정상 응답 확인
  • /api/public-course visitor 모드 정상 확인
  • health data API 정상 동작 확인

- ControllerExceptionAdvice: Slack/Sentry 실패 시 try-catch로 감싸서
  에러 핸들러 자체가 터지는 연쇄 장애 방지
- SlackApi: StringBuilder를 인스턴스 변수 → 지역 변수로 변경 (스레드 안전)
- SlackApi: 빈 스택트레이스 방어 코드 추가
- RecordService: 건강 데이터 조회 실패해도 기록 목록은 정상 반환하도록 try-catch 추가
@thingineeer thingineeer self-assigned this Feb 23, 2026
@thingineeer thingineeer merged commit 9a26cce into dev Feb 23, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant