[HIGH] 메인 DB 연결에 WAL 모드 미적용 — 대시보드 동시 접근 시 락 오류 #210

Closed
opened 2026-02-23 10:03:30 +09:00 by agentson · 0 comments
Collaborator

문제

대시보드(src/dashboard/app.py)는 WAL 모드와 busy_timeout을 적용하지만, 메인 트레이딩 루프의 DB 연결(src/db.py:16)은 기본 journal 모드를 사용한다.

# db.py:16 — WAL 없음
conn = sqlite3.connect(db_path)

# dashboard/app.py:439 — WAL 적용됨
conn.execute("PRAGMA journal_mode=WAL")
conn.execute("PRAGMA busy_timeout=8000")

영향

--dashboard 플래그로 실행 시 대시보드와 트레이딩 루프가 동시에 DB에 접근하면 database is locked 오류 발생 가능.

수정 방법

src/db.pyinit_db() 또는 connect() 함수에 WAL 설정 추가:

conn.execute("PRAGMA journal_mode=WAL")
conn.execute("PRAGMA busy_timeout=5000")
## 문제 대시보드(`src/dashboard/app.py`)는 WAL 모드와 busy_timeout을 적용하지만, 메인 트레이딩 루프의 DB 연결(`src/db.py:16`)은 기본 journal 모드를 사용한다. ```python # db.py:16 — WAL 없음 conn = sqlite3.connect(db_path) # dashboard/app.py:439 — WAL 적용됨 conn.execute("PRAGMA journal_mode=WAL") conn.execute("PRAGMA busy_timeout=8000") ``` ## 영향 `--dashboard` 플래그로 실행 시 대시보드와 트레이딩 루프가 동시에 DB에 접근하면 `database is locked` 오류 발생 가능. ## 수정 방법 `src/db.py`의 `init_db()` 또는 `connect()` 함수에 WAL 설정 추가: ```python conn.execute("PRAGMA journal_mode=WAL") conn.execute("PRAGMA busy_timeout=5000") ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#210