history-db should handle OperationalError: database is locked

Bug #716777 reported by John A Meinel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
loggerhead
Triaged
Low
Unassigned
loggerhead-breezy
Triaged
Low
Unassigned

Bug Description

If you have multiple instances of loggerhead serving the same content, and sharing the same cache files, it is entirely possible that both processes will want to write to the same cache file concurrently.

This is pretty easy to trigger if you use 'bzr serve --http' and configure "http_sql_dir" so you have a permanent shared (single) cache.

A single process currently excludes multiple writers by using a threading.Lock. We should probably just spin around the OperationalError, because that allows us to support multiple concurrent processes, rather than just multiple threads in a single process.

How I set up testing this:

  http_sql_dir = /path/to/sql/cache

# Make sure the cache doesn't exist, so that serving a request takes a while to build it
rm /path/to/sql/cache/historydb.sql
cd $launchpad
bzr serve --http --port 8080 &
bzr serve --http --port 8081 &

wget http://localhost:8080/lp-branches/devel/changes &
wget http://localhost:8081/lp-branches/devel/changes &

The second request should fail and there should be a traceback about sqlite cache file locked.

Marking this critical, because it should really block landing history-db into trunk.

John A Meinel (jameinel)
tags: added: history-db-blocker
Vincent Ladeuil (vila)
affects: bzr → loggerhead
Revision history for this message
Robert Collins (lifeless) wrote :

I'm dropping this to high because its not a regression/oops/timeout or escalated by a stakeholder. I do think its very important, just not drop-everything as critical is. And yes, I think its a blocker to merging historydb to trunk.

Changed in loggerhead:
status: Confirmed → Triaged
importance: Critical → High
Revision history for this message
Robert Collins (lifeless) wrote :

This is high as far as getting history-db live, but that project isn't currently moving.

Changed in loggerhead:
importance: High → Low
Jelmer Vernooij (jelmer)
Changed in loggerhead-breezy:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.