Issue updating from 0.6.0 to 0.6.1
Running: Windows 7 x64 Attempted both x86 and x64 builds of BitMessage
BitMessage crashed shortly after running. I see an error in the debug.log file:
CRITICAL - Major error occurred when trying to execute a SQL statement within the sqlThread. Please tell Atheros about this error message or post it in the forum! Error occurred while trying to execute statement: "SELECT objecttype, streamnumber, payload, expirestime, tag FROM inventory WHERE hash=?"
Following this are some parameters it says are sensitive (which I have left out) as well as the text:
Here is the actual error message thrown by the sqlThread: database disk image is malformed
After reverting back to 0.6.0, BitMessage starts without issue.
Keep an eye on this, it may rear its ugly head again. I've experienced a malformed SQLite database file before and everything works perfectly until a particular page or record is accessed. Luckily for you it's a page associated with the inventory table which isn't that important so you should be able to use the sqlite3 CLI utility .dump command to recover your data.
I haven't changed anything in the schema, however I changed how PyBM reacts to database errors. Now it immediately quits, because when you run it with with a corrupt database, you make things worse.
Most likely there is something wrong with your sqlite database. Like @bmng-dev said, make a dump and restore. There is a tool that also works with windows: http://sqlitebrowser.org/. Since it complains about the inventory table, that's a bit on the positive side, maybe just removing the entries from that table will help. But in any case, make a dump and backup the old messages.dat before trying anything.
Let me know if you need further assistance.
The immediate quit may be the cause of the corruption. os._exit seems like an ungraceful way to exit to me. At the very least the database connection should be closed before exiting. However I think the impact of such an abrupt exit should be properly assessed for the rest of program (eg. the singleton lockfile not released/deleted, GUI settings/knownnodes lost or corrupted, etc).
The guy who triggered this change insists on using BM while occasionally running out of diskpace for other reasons. In such a case, having anything else write to the disk will fail as well, so an abrupt shutdown I consider a safer choice. If however the problem is db corruption like here, maybe the shutdown can be smoother. I'll investigate this.
Just to clarify, the immediate exit only happens on fatal SQL errors (and SQL commands are serialised within PyBM) and maybe also on certain "disk full" errors (I'm not sure about the latter). Any other attempt to quit is very graceful and I actually fixed several potential lockups that could occur during the shutdown procedure that previously necessitated kill -9. The GUI will also notify you of shutdown progress, e.g. if it has to wait for PoW to finish.
Well, I've resolved this issue by using sqlite to drop the transactions table and recreate it. Afterwards, 0.6.1 started without an issue. As a note, I had almost 57MB of data in that table... I'm not sure if that's normal but now my message.dat is significantly smaller. Thanks for your recommendations and sorry for the long response time.
I think there is nothing left to do here, just the temporary directory needs to be fixed through #1229 .