Skip to content

fix: AuthInterceptor 토큰 재발급 실패 시 응답 leak으로 인한 크래시 수정 - #410

Merged
unam98 merged 2 commits into
developfrom
fix/auth-interceptor-response-leak
Aug 18, 2026
Merged

fix: AuthInterceptor 토큰 재발급 실패 시 응답 leak으로 인한 크래시 수정#410
unam98 merged 2 commits into
developfrom
fix/auth-interceptor-response-leak

Conversation

@unam98

@unam98 unam98 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

작업 배경

  • 코스 상세 화면을 딥링크로 진입할 때 크래시가 재현됨 (FATAL EXCEPTION: OkHttp Dispatcher, IllegalStateException: closed)
  • 딥링크 자체는 문제가 아니었고, SchemeActivity.isUserLoggedIn()이 토큰의 유효성 검증 없이 "존재 여부"만 확인해서, access/refresh 토큰이 둘 다 무효한 상태에서도 API를 그대로 호출하는 경로였음

원인

AuthInterceptor.handleGetNewTokenFailure가 토큰 재발급 요청의 실패 응답(refreshTokenResponse)을 close() 하지 않고 반환함. 안 닫힌 Response가 OkHttp 커넥션 풀을 오염시켜서, 바로 이어지는 재시도 요청의 응답을 읽던 HttpLoggingInterceptorIllegalStateException: closed로 죽음.

바로 위 handleGetRefreshTokenSuccessrefreshTokenResponse.use { ... }로 제대로 닫는데, 실패 케이스만 빠뜨린 비대칭 버그였음.

변경 사항

  • refreshTokenResponse.close() 한 줄 추가

영향 범위

  • access token과 refresh token이 모두 만료/무효한 모든 경우에 영향 (딥링크 진입에 국한되지 않음)
  • 딥링크 진입 시 더 자주 노출되는 이유: SchemeActivity가 토큰 유효성 검증 없이 바로 API 호출

Test Plan

  • 실기기에서 access+refresh 토큰이 모두 무효한 상태로 딥링크 진입 → 수정 전 크래시 재현, 수정 후 크래시 없음(3회 반복 재현 후 확인) 확인
  • ./gradlew testDebugUnitTest 전체 통과

🤖 Generated with Claude Code

handleGetNewTokenFailure가 실패한 refreshTokenResponse를 close() 하지
않고 반환해서, OkHttp 커넥션 풀이 오염되고 이후 재시도 응답을 읽던
HttpLoggingInterceptor가 IllegalStateException: closed로 크래시했음.
access/refresh 토큰이 둘 다 무효할 때 재현됨 (예: 딥링크로 진입 시
토큰 유효성 검증 없이 바로 API를 호출하는 경로에서 자주 노출).
@unam98 unam98 self-assigned this Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@unam98, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 23 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 64a98230-d3b8-4232-88b1-c80b4ba2e1bd

📥 Commits

Reviewing files that changed from the base of the PR and between c2ea494 and f3abc8a.

📒 Files selected for processing (2)
  • app/build.gradle
  • app/src/main/java/com/runnect/runnect/data/service/AuthInterceptor.kt

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

PR diff로 변경된 패키지만 --tests 필터로 골라 돌리는 CI 스크립트가,
그 패키지에 테스트 클래스가 하나도 없으면 "No tests found for given
includes"로 빌드 자체를 실패시켰음. failOnNoMatchingTests=false로
이 경우 그냥 스킵하도록 수정.
@unam98
unam98 merged commit 996f0af into develop Aug 18, 2026
3 checks passed
@unam98
unam98 deleted the fix/auth-interceptor-response-leak branch August 18, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant