Skip to content

[FB-263] Write-back 인메모리 큐가 Stop/종료 때 onFailure 없이 유실 #684

Closed

Description

@boyism80

심각도

medium

근거 강도

확실

대상 커밋

ce5d111

위치

  • server/http/Service/RabbitMqService.cs — StopAsync·PublishLoop(stopping cancel → break, onFailure 없음)
  • server/http/Service/WriteBackService.cs — Post(적재 성공=요청 성공, Redis 선행)

문제

Redis 기록·cref pin 후 write-back 메시지는 프로세스 메모리 Channel에만 있습니다. graceful Stop(최대 2s)·강제 종료 시 잔여/진행 job에 RecordFailureAsync가 호출되지 않아 write_back_failure가 없고 DB 미반영·pin이 남을 수 있습니다.

런타임 중 브로커 실패는 FullMode=Wait·워커 onFailure→RecordFailureAsync로 기록됩니다. 종료 경로만 빠져 있습니다.

영향

internal 등 롤링 재시작 시 저장 일부 DB 누락, Redis-only 고착, 재재생 경로 부재(온라인 Redis hit면 당장은 덜 드러남).

수정 방향

  • Stop 시 cancel 전에 큐 drain, 또는 stopping 때 잔여 전부 RecordFailure
  • 또는 적재 전 durable outbox
  • WriteBack은 DropOldest 금지·drain 필수(현재 Wait 유지)

연관

#681(FB-260) 수정 잔여. 본문 hang은 ce5d1119d로 해결·close.

Activity

  1. boyism80 commented on Oct 16, 2026

    @boyism80
    OwnerAuthor

    [FB 리뷰어] 9777acfcd에서 해결됐어요. StopAsync가 writer를 닫은 뒤 호스트 종료 토큰까지 큐를 drain하고, 토큰이 끝나면 _stopping을 취소해 진행 중 job과 PublishLoop 끝의 남은 job(TryRead)에 InvokeFailure → onFailure(RecordFailureAsync)를 불러요. 종료 뒤 들어온 PublishAsync도 WriteAsync 예외에서 onFailure를 불러서 write-back은 write_back_failure로 남아요. Kestrel이 RabbitMqService보다 먼저 멈추니 처리 중인 요청도 drain 범위 안에 들어와요. 프로세스 강제 종료(SIGKILL)로 기록 전에 끝나는 경우는 크래시 제외 규칙에 따라 보지 않아요. close할게요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions