Skip to content

task: dashboard read-path thread-safety (per-thread boto3 store) — M8 #56 follow-up #57

@pureliture

Description

@pureliture

배경

PR #56 (M8 admin control-plane UI) 리뷰에서 gemini-code-assist가 지적한 thread-safety 항목의 추적 이슈.

runtime/dashboard.pyThreadingWSGIServer(ThreadingMixIn)는 요청을 스레드별로 처리하지만, make_dashboard_app(store, …)단일 store 인스턴스를 모든 요청 스레드와 공유한다. dynamodb 어댑터(storage/adapters/nosql_db/store.py:155-157)는 단일 boto3 resource/Table(self._resource/self._table)을 들고 있고 boto3 resource/Session은 thread-safe하지 않다. 동시 요청 시 race/예외/직렬화 캐시 오염 가능.

왜 지금 PR에서 안 고치고 분리하나

  • F9 trust model = loopback bind(127.0.0.1) 단일 운영자. 공개 부하가 아니라 폭발 반경이 제한적.
  • 클라이언트는 in-flight 락으로 폴 중첩을 막아 단일 탭 동시성은 /snapshot+/findings 정도.
  • 정확한 수정(per-thread store)은 make_dashboard_app/run_dashboard/cli/commands/dashboard.py 시그니처 + 테스트 변경을 동반 → PR feat(dashboard): M8 admin control-plane UI — read-only live dashboard (scale #2 GATE3) #56 범위 확대. 응집을 위해 분리.

영향 파일

  • src/security_scanner/runtime/dashboard.py (make_dashboard_app, run_dashboard)
  • src/security_scanner/runtime/read_api.py:426-431 (공유 store로 라우트 dispatch)
  • src/security_scanner/storage/adapters/nosql_db/store.py:155-157 (공유 boto3 resource/Table)

Acceptance Criteria

  • 동시 요청이 boto3 resource/Table을 공유하지 않음: threading.local 기반 per-thread store(스레드별 boto3 resource/Table 지연 생성) 또는 thread-safe 저수준 client 경로.
  • make_dashboard_app를 store-factory 주입형으로 조정(테스트는 factory 또는 per-thread fake로 갱신).
  • 정적 자산 경로(serve_static)는 store 미사용이므로 무영향 유지.
  • 회귀: 기존 dashboard 테스트 + node --test 그린.

출처: PR #56 review (gemini-code-assist, dashboard.py:180). 우선순위: trust model상 낮음(triage 필요).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions