Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skyrl/tinker/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def enable_sqlite_wal(engine) -> None:
def _set_sqlite_pragma(dbapi_connection, connection_record):
cursor = dbapi_connection.cursor()
cursor.execute("PRAGMA journal_mode=WAL")
cursor.execute("PRAGMA busy_timeout=30000")
cursor.execute("PRAGMA busy_timeout=300000")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Increasing the SQLite busy_timeout to 300 seconds (5 minutes) is extremely high and poses a significant risk of thread pool starvation. Since this application uses aiosqlite (which runs blocking SQLite operations in a thread pool), blocking a database thread for up to 5 minutes under heavy write contention can quickly exhaust the thread pool. This will freeze all other database operations (including reads) and potentially cause health checks or other asynchronous tasks to time out.

Consider using a more reasonable timeout (e.g., 60 seconds) combined with application-level retries with exponential backoff, or optimizing transaction boundaries to keep write locks as short as possible.

Suggested change
cursor.execute("PRAGMA busy_timeout=300000")
cursor.execute("PRAGMA busy_timeout=60000")

cursor.close()


Expand Down
Loading