Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

SQLite3::CorruptException: database disk image is malformed

#6125

I have a highly repeatable scenario which produces the exception mentioned above.

It happens on 3.1 master, but not on 3-0-stable. It happens on some of my machines, but not all of them. It happens when I try it "manually" by visiting the application using a browser. Changing the scenario slightly changes the frequency of the problem -- simply adding a call to "rake test" or removing pagination or even mail can make the problem occur less frequently.

I've posted the scenario and a snapshot of the application just before the failure online: http://intertwingly.net/stories/2010/12/07/

To reproduce:

  • download and unpack either the zip or tgz file
  • edit Gemfile, and modify the paths
  • bundle install
  • rake db:migrate db:seed
  • rails server
  • visit the root page (localhost:3000)
  • click on the first Add to Cart button, then Checkout; then Place Order

Reported by Sam Ruby · December 7th, 2010 @ 08:25 PM

State: resolved
Milestone: 3.1
Assigned to: Aaron Patterson Aaron Patterson
Importance: High

Activity

  1. Sam Ruby
    Sam Ruby

    My status:

    Fails on Ubuntu 10.04.1, SQLite3 version 3.6.22, AMD Athlon(tm) 64 Processor 3800+ (desktop)

    Fails on Ubuntu 10.04.1, SQLite3 version 3.6.22, AMD Athlon(tm) Processor LE-1640 (desktop)

    Passes on Ubuntu 10.04.1, SQLite3 version 3.6.22, AMD Athlon(tm) II X2 240 Processor (desktop)

    Passes on RHEL 6,SQLite3 version 3.6.20, Intel Core 2 Duo (IBM Thinkpad)

    Passes on Mac OSX 10.5.8, SQLite3 version 3.6.23.1, Intel Core 2 Duo (mac mini)

    Failures cross Ruby versions (i.e., I see the same result with 1.8.7, 1.8.8, 1.9.2, and 1.9.3). If I find other environmental differences, I will report them back here.

    December 7th, 2010 @ 08:46 PM

  2. Sam Ruby
    Sam Ruby
    • Assigned user set to José Valim
    • Importance changed from Medium to High
    ae44bf7c7ebb39d9a12d5253016f92617bee79c7 is the first bad commit
    commit ae44bf7c7ebb39d9a12d5253016f92617bee79c7
    Author: Josh Kalderimis <josh.kalderimis@gmail.com>
    Date:   Thu Nov 18 00:32:43 2010 +0100
    
        bye bye extlib_inheritable_*, AS callbacks now using class_attribute
        
        Signed-off-by: José Valim <jose.valim@gmail.com>
    

    Reproduction instructions here: http://intertwingly.net/blog/2010/12/07/SQLite3-CorruptException-da...

    December 8th, 2010 @ 08:28 PM

  3. Sam Ruby
    Sam Ruby
    • State changed from incomplete to open
    • Tag set to corrupt sqlite3

    December 8th, 2010 @ 08:58 PM

  4. Aaron Patterson
    Aaron Patterson

    Hey Sam,

    I was able to reproduce (yay). I haven't found a solution yet though.

    I found that the database corruption would only happen if postfix was running. You can have postfix installed, but if you stop the process, the db corruption won't happen.

    December 21st, 2010 @ 05:19 PM

  5. Sam Ruby
  6. Aaron Patterson
    Aaron Patterson

    Fuck ya!

    Here are appropriate commits to Ruby and the mail gem that fix this problem.

    December 23rd, 2010 @ 10:38 PM