External Publication
Visit Post

Problems • Re: Server crashed for problem about DB

Luanti Forums - Index page [Unofficial] March 18, 2026
Source

2026-03-17 17:18:17: ERROR[Main]: Failed to set SQLite3 synchronous mode: database is locked

It looks like you have the world open already in singleplayer or another server instance. I get a similar one when using world downloading and running a server at the same time on the same computer. If there's nothing obviously running, try searching for crashed/zombie processes that have it open.

Thank you! It has more causes (synchronous SQLite, large -wal etc.)

Problem solved. Part of this message (bellow this) created by AI (Google Gemini that helps me with it step by step) and checked and repaired by human.

Post-Mortem: Luanti Server Crash & SQLite Database Lock

Root Cause The server experienced a fatal crash triggered by a Lua runtime error in a mod (railbuilder), which attempted to index a nil value during a global step. This occurred during high I/O activity (multiple users building tracks).

The situation was exacerbated by a misconfiguration in minetest.conf: sqlite_synchronous = 1 (NORMAL). On a server with a large 10GB database and heavy mods like AdvTrains, this caused an I/O bottleneck. When the crash happened, the SQLite checkpoint failed, leaving a massive 8.5GB -wal file and locking the database.

Symptoms

  1. Database is locked: The server failed to restart because the previous process didn't release the file lock, and the massive WAL file prevented a quick recovery.
  2. Map Corruption/Ghost Blocks: Attempting to force-start by deleting journal files led to temporary synchronization issues between the old map.sqlite and the uncommitted data.
  3. Extended "Starting" state: Pterodactyl panel stayed yellow for minutes as SQLite struggled to replay the oversized WAL log.

Resolution

  1. Manual Checkpoint: Downloaded the 10GB map.sqlite and 8.5GB map.sqlite-wal to a local high-performance machine (i7-13700).
  2. Database Integration: Executed PRAGMA wal_checkpoint(TRUNCATE); via SQLite3 CLI to force-merge the logs into the main DB.
  3. Optimization: Performed VACUUM; to defragment the 10M+ rows and fix indexing issues.
  4. Code Fix: Patched railbuilder_ui.lua with a nil-check for player positions to prevent the specific crash from recurring.
  5. Config Tuning: Set sqlite_synchronous = 0` and adjusted map_save_interval to 20s to prevent future I/O deadlocks on SATA SSD storage.

Status: Server fully recovered with zero data loss.

Statistics: Posted by MatyasP — Wed Mar 18, 2026 10:18


Discussion in the ATmosphere

Loading comments...