[typo] sqlite "database is locked" exceptions

Victor Jalencas victor-typo at carotena.net
Wed Dec 21 13:26:04 EST 2005


I have observed the same, and not only for typo. Since I only use sqlite 
for local development it hasn't bothered me much, I usually just restart 
the webserver and I'm done with it. But of course, having this happen on 
a production server sucks

  I didn't give it much thought because I assumed it was my fault 
somehow, for abusing ActiveRecord.


Victor

Jens Alfke wrote:
> I've just installed Typo (the current stable build) in my DreamHost  
> account. I followed the directions on the handy Typo-DreamHost page  
> (thanks!) except I configured it for sqlite instead of mysql.
> 
> The site ran fine for five minutes, but halfway through configuring  
> my blog it started to return the dreaded "Application Error", first  
> intermittently and now constantly.
> 
> The production.log shows a bunch of Ruby exceptions. Most of them  
> look like the one I've pasted below -- a sqlite query fails with  
> "database is locked". I think what's happening is that there are  
> multiple fcgi processes and when two try to access the database at  
> the same time, the one that gets there second is not handling the  
> lock errors gracefully (by waiting and retrying); instead it decides  
> the query has failed and throws an exception.
> 
> Is this a known bug? I'm a total Rails newbie (though I have a little  
> experience with Ruby and a lot with sqlite) so it's possible I  
> screwed something up in my install.
> 
> And yes, I will work around this by setting up mysql instead. I just  
> hate having to configure some lumbering industrial-strength db server  
> with its own account setup, just to run one little blog :)
> 
> --Jens
> 
> 
> Processing Base#show_available (for 69.12.133.193 at 2005-12-21  
> 09:18:08) [POST]
>    Parameters: {"action"=>"show_available", "controller"=>"admin/ 
> sidebar"}
> 
> 
> ActiveRecord::StatementInvalid (database is locked: UPDATE sessions  
> SET 'updated_at' = '2005-12-21 09:18:08', 'data' = 'BAh7BzoJdXNlcm86CVVz
> ZXIGOhBAYXR0cmlidXRlc3sKIgluYW1lIg9KZW5z
> IEFsZmtlIgdpZCIGMSIKbG9naW4iCWplbnMiDXBhc3N3b3JkIi1lM2YzZTYz
> MDgyNDUyNDU0YTdiY2VlOWRlYjYyMzc2M2Y0YTAwMDkwIgplbWFpbCIXamVu
> c0Btb29zZXlhcmQuY29tIgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVyOjpG
> bGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA
> ', 'sessid' = '6eb4029b9917899cce11dd4c98b7da0d' WHERE id = 1):
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/connection_adapters/abstract_adapter.rb:67:in `log'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/connection_adapters/sqlite_adapter.rb:133:in `execute'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/connection_adapters/sqlite_adapter.rb:137:in `update'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/base.rb:1436:in `update_without_lock'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/locking.rb:45:in `update_without_callbacks'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/callbacks.rb:274:in `update_without_timestamps'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/timestamp.rb:39:in `update'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/base.rb:1431:in `create_or_update_without_callbacks'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/callbacks.rb:249:in `create_or_update'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/base.rb:1231:in `save_without_validation'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/validations.rb:687:in `save_without_transactions'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/transactions.rb:126:in `save'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/transactions.rb:126:in `transaction'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/transactions.rb:91:in `transaction'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/transactions.rb:118:in `transaction'
>      /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/ 
> active_record/transactions.rb:126:in `save'
>      /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/ 
> action_controller/session/active_record_store.rb:294:in `update'
>      /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/ 
> action_controller/session/active_record_store.rb:294:in `silence'
>      /usr/lib/ruby/gems/1.8/gems/actionpack-1.11.0/lib/ 
> action_controller/session/active_record_store.rb:294:in `update'
> ...
> _______________________________________________
> Typo-list mailing list
> Typo-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/typo-list



More information about the Typo-list mailing list