Skip to content

fix(mcp): 파이프라인 호출을 전용 단일 워커 스레드에 고정#3

Merged
dongwhee merged 1 commit intomainfrom
develop
Apr 17, 2026
Merged

fix(mcp): 파이프라인 호출을 전용 단일 워커 스레드에 고정#3
dongwhee merged 1 commit intomainfrom
develop

Conversation

@dongwhee
Copy link
Copy Markdown
Collaborator

Summary

  • src/trawl_mcp/server.py의 파이프라인 호출을 전용 단일 워커 스레드에 고정하여 이벤트 루프 블로킹/스레드 경합 이슈를 방지

Test plan

  • python tests/test_pipeline.py — 파리티 매트릭스 12/12
  • python tests/test_mcp_server.py — stdio 프로토콜 스모크

`asyncio.to_thread`의 기본 executor는 여러 워커에 작업을 분배하는데,
trawl 파이프라인이 쓰는 sync_playwright의 greenlet 디스패처는 최초
호출 스레드에 핀되므로 다른 워커로 들어온 호출이 "Cannot switch to
a different thread" greenlet.error를 뱉었다.

max_workers=1인 전용 ThreadPoolExecutor로 모든 fetch_page /
profile_page 호출을 동일 스레드에 고정해 이 간헐적 실패를 제거한다.
@dongwhee dongwhee merged commit 06ce93c into main Apr 17, 2026
3 of 4 checks passed
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