Repository navigation
Description
On v2026.5.3, opening the gallery of a case that holds many container rows freezes the server. Every request after that times out and the process sits at 0% CPU until it is killed.
Seen on the signed macOS arm64 release (GLEAPP 2026.5.3), run as GLEAPP web, with a case built from a full file system extraction zip read in place: 149,825 rows, 119,604 of them containers (compressed files listed and left closed).
- First run: the freeze came during ingest, right after registration, when the page loaded the gallery.
- Second run: ingest was started and left alone with no page open, and finished in about 7.5 minutes. The first page load of the finished case froze the server.
Two cases with almost no container rows (a Project VIC import of 14,656 files and a 20-file folder) built and opened normally on the same build.
Cause
CaseDB registers a Python SQL function, is_exo_cache_name, on the one connection all threads share (db.py#L344-L352). The /api/context query for the sidebar's "Archives and documents" counts calls it once per container row through _archive_sql (app.py#L1832-L1834, app.py#L2627), and that query runs outside self.lock.
sample on the frozen process shows two threads waiting on each other, the same pair both times:
thread A: pysqlite_connection_execute > sqlite3_step > func_callback > PyGILState_Ensure > take_gil
thread B: pysqlite_connection_execute[many] > bind_param > bindText > vdbeUnbind > __psynch_mutexwait
Thread A is inside sqlite3_step, so it holds the connection's mutex, and its callback is waiting for the GIL. Thread B holds the GIL (the sqlite3 module does not release it while binding parameters) and is waiting for the connection's mutex. With 119,604 callbacks in one step the window is long, and a page load sends several requests at once.
Possible fixes
- Keep Python out of SQL on the shared connection: decide "is this an ExoPlayer cache piece" once at ingest and store it in a column, or express the rule in plain SQL.
- Or run every statement that can call the function under
self.lock, with every other statement on that connection under the same lock. - Or give request threads their own read connection.
A regression test can build a case with a few thousand container rows and call /api/context from one thread while another writes, under a timeout.
Activity
Store whether a row is an ExoPlayer cache file instead of asking Pyth…