Discussion:
"database disk image is malformed"?
(too old to reply)
David Given
2013-08-29 20:10:49 UTC
Permalink
This is head-scratchingly weird:

***@hilfy:/tmp$ fossil clone
https://dg%40cowlark.com:<pass>@fossil-scm.org fossil.fossil
Bytes Cards Artifacts Deltas
Sent: 53 1 0 0
Received: 4000570 12097 1288 4774
Sent: 71 2 0 0
Error: Database error: SQL error: database disk image is malformed
Received: 74 1 0 0
Total network traffic: 548 bytes sent, 4000963 bytes received
fossil: server returned an error - clone aborted

OTOH:

***@hilfy:/tmp$ fossil clone https://fossil-scm.org fossil.fossil
Bytes Cards Artifacts Deltas
Sent: 53 1 0 0
Received: 4000570 12097 1288 4774
Sent: 71 2 0 0
Received: 4064285 13221 2203 4370
Sent: 57 95 0 0
...etc...

That's on my desktop PC, which is amd64 running Debian, so that's fossil
1.22. OTOH my ARM server box runs more-or-less tip, and it happens there
too:

***@anify:/tmp$ fossil clone
https://dg%40cowlark.com:<pass>@fossil-scm.org fossil.fossil
Error: Database error: SQL error: database disk image is malformed
Round-trips: 2 Artifacts sent: 0 received: 6062
Clone finished with 548 bytes sent, 4000963 bytes received
fossil: server returned an error - clone aborted

This isn't a blocking issue because I can always clone anonymously and
then sync with the username and password, but can anyone reproduce this?
--
┌───  ───── http://www.cowlark.com ─────
│
│ "Ripley's Law: Never go further for the cat than the cat would go for
│ you." --- Vexxarr Bleen (trans. Hunter Cressall)
Stephan Beal
2013-08-29 20:24:49 UTC
Permalink
Post by David Given
Bytes Cards Artifacts Deltas
Sent: 53 1 0 0
Received: 4000570 12097 1288 4774
Sent: 71 2 0 0
Error: Database error: SQL error: database disk image is malformed
Me, too:

[***@host:~/tmp]$ fossil clone http://stephan:***@fossil-scm.orgf.fsl
Round-trips: 2 Artifacts sent: 0 received: 6062
Error: Database error: SQL error: database disk image is malformed
Round-trips: 2 Artifacts sent: 0 received: 6062
Clone finished with 542 bytes sent, 4000963 bytes received
server returned an error - clone aborted

:-?

Update from my primary clone works fine.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
Stephan Beal
2013-08-29 20:26:14 UTC
Permalink
Post by David Given
Round-trips: 2 Artifacts sent: 0 received: 6062
Error: Database error: SQL error: database disk image is malformed
BTW:

[***@host:~/cvs/fossil/fossil]$ f ver
This is fossil version 1.26 [669f22fb7c] 2013-08-27 13:50:02 UTC
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
Richard Hipp
2013-08-29 20:27:54 UTC
Permalink
The database has gone corrupt on the server. Give me a few minutes to
figure out what it going on.....
Post by David Given
Post by David Given
Bytes Cards Artifacts Deltas
Sent: 53 1 0 0
Received: 4000570 12097 1288 4774
Sent: 71 2 0 0
Error: Database error: SQL error: database disk image is malformed
Round-trips: 2 Artifacts sent: 0 received: 6062
Error: Database error: SQL error: database disk image is malformed
Round-trips: 2 Artifacts sent: 0 received: 6062
Clone finished with 542 bytes sent, 4000963 bytes received
server returned an error - clone aborted
:-?
Update from my primary clone works fine.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
fossil-users mailing list
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
--
D. Richard Hipp
***@sqlite.org
Richard Hipp
2013-08-29 20:38:33 UTC
Permalink
A corruption occurred in the CONCEALED table on the server. Still don't
know how that happened. I have fixed the table and so downloads should be
working again. Continuing to investigate the source of corruption.

Additional information:

(1) All of the other 77 fossil repositories on that server have been
checked and are working fine.

(2) The CONCEALED table maps SHA1 hashes of user email address back into
their the original email address. It allows emails to be stored in tickets
using the SHA1 hash of the email address rather than the literal text.

(3) This has never happened before.
Post by Richard Hipp
The database has gone corrupt on the server. Give me a few minutes to
figure out what it going on.....
Post by David Given
Post by David Given
Bytes Cards Artifacts Deltas
Sent: 53 1 0 0
Received: 4000570 12097 1288 4774
Sent: 71 2 0 0
Error: Database error: SQL error: database disk image is malformed
Round-trips: 2 Artifacts sent: 0 received: 6062
Error: Database error: SQL error: database disk image is malformed
Round-trips: 2 Artifacts sent: 0 received: 6062
Clone finished with 542 bytes sent, 4000963 bytes received
server returned an error - clone aborted
:-?
Update from my primary clone works fine.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
_______________________________________________
fossil-users mailing list
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
--
D. Richard Hipp
--
D. Richard Hipp
***@sqlite.org
Richard Hipp
2013-08-29 20:50:19 UTC
Permalink
The database corruption was caused by scenario 1.1 at
http://www.sqlite.org/howtocorrupt.html.

Apparently, file descriptor 2 was closed. Then SQLite used file descriptor
2 to open a connection to the database file. Then an assert() failed,
wrote to file descriptor 2, and overwrote a portion of the CONCEALED
table. At the beginning of one page of the CONCEALED table we see this
text:

fossil: ../m1/src/blob.c:253: blob_str: Assertion
`(p)->xRealloc==blobReallocMalloc || (p)->xRealloc=blobReallocStatic'
failed.
--
D. Richard Hipp
***@sqlite.org
Stephan Beal
2013-08-29 20:56:12 UTC
Permalink
Post by Richard Hipp
The database corruption was caused by scenario 1.1 at
http://www.sqlite.org/howtocorrupt.html.
"Another thread"?
Post by Richard Hipp
Apparently, file descriptor 2 was closed. Then SQLite used file
descriptor 2 to open a connection to the database file. Then an assert()
failed, wrote to file descriptor 2, and overwrote a portion of the
CONCEALED table. At the beginning of one page of the CONCEALED table we
fossil: ../m1/src/blob.c:253: blob_str: Assertion
`(p)->xRealloc==blobReallocMalloc || (p)->xRealloc=blobReallocStatic'
failed.
That assertion can be triggered from about a thousand places :/. If you can
give us a stack trace or tell us what operation triggered it, i can try to
reproduce it locally.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
Richard Hipp
2013-08-29 21:01:26 UTC
Permalink
Cross-posting to sqlite-dev....
Post by Stephan Beal
Post by Richard Hipp
The database corruption was caused by scenario 1.1 at
http://www.sqlite.org/howtocorrupt.html.
"Another thread"?
Post by Richard Hipp
Apparently, file descriptor 2 was closed. Then SQLite used file
descriptor 2 to open a connection to the database file. Then an assert()
failed, wrote to file descriptor 2, and overwrote a portion of the
CONCEALED table. At the beginning of one page of the CONCEALED table we
fossil: ../m1/src/blob.c:253: blob_str: Assertion
`(p)->xRealloc==blobReallocMalloc || (p)->xRealloc=blobReallocStatic'
failed.
That assertion can be triggered from about a thousand places :/. If you
can give us a stack trace or tell us what operation triggered it, i can try
to reproduce it locally.
It would be nice to fix the cause of the assertion, yes. But I am
significantly more worried that an assertion firing can overwrite and
corrupt the database file!

Perhaps SQLite should be modified so that it will not accept file
descriptor 0, 1, or 2 for use with a database file?
--
D. Richard Hipp
***@sqlite.org
Joerg Sonnenberger
2013-08-29 21:33:19 UTC
Permalink
Post by Richard Hipp
The database corruption was caused by scenario 1.1 at
http://www.sqlite.org/howtocorrupt.html.
Apparently, file descriptor 2 was closed.
The question for me would be why. That should not happen and any code
should at most re-open fd 2 as /dev/null...

Joerg
Richard Hipp
2013-08-29 21:44:40 UTC
Permalink
Post by Joerg Sonnenberger
Post by Richard Hipp
The database corruption was caused by scenario 1.1 at
http://www.sqlite.org/howtocorrupt.html.
Apparently, file descriptor 2 was closed.
The question for me would be why. That should not happen and any code
should at most re-open fd 2 as /dev/null...
That is a question I've been looking into but do not yet have an answer for.
--
D. Richard Hipp
***@sqlite.org
B Harder
2013-08-30 02:59:09 UTC
Permalink
Did this nuke accounts/passwords ?
On Thu, Aug 29, 2013 at 5:33 PM, Joerg Sonnenberger
Post by Joerg Sonnenberger
Post by Richard Hipp
The database corruption was caused by scenario 1.1 at
http://www.sqlite.org/howtocorrupt.html.
Apparently, file descriptor 2 was closed.
The question for me would be why. That should not happen and any code
should at most re-open fd 2 as /dev/null...
That is a question I've been looking into but do not yet have an answer for.
--
D. Richard Hipp
--
Brad Harder
Method Logic Digital Consulting
http://www.methodlogic.net/
http://twitter.com/bcharder
Richard Hipp
2013-08-30 03:12:23 UTC
Permalink
Post by B Harder
Did this nuke accounts/passwords ?
Possibly. I restored from backup. But if passwords changed recently, the
backup might have missed them.
--
D. Richard Hipp
***@sqlite.org
B Harder
2013-08-30 04:35:58 UTC
Permalink
I don't know what the definition of "recent" is, but I think my password is
same for months, wasn't working at time I sent last msg. I'll work with you
off-list if necessary.

Thanks drh,

-bch
Post by Richard Hipp
Post by B Harder
Did this nuke accounts/passwords ?
Possibly. I restored from backup. But if passwords changed recently, the
backup might have missed them.
--
D. Richard Hipp
_______________________________________________
fossil-users mailing list
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Richard Hipp
2013-08-30 04:57:51 UTC
Permalink
Post by B Harder
I don't know what the definition of "recent" is, but I think my password
is same for months, wasn't working at time I sent last msg. I'll work with
you off-list if necessary.
I'm still working on the problem. I'll get it fixed as quickly as I can.
Sorry for the inconvenience.
--
D. Richard Hipp
***@sqlite.org
B Harder
2013-08-30 06:50:40 UTC
Permalink
Richard, your service on all this is exemplary -- anybody who gives
you grief over this should just take a moment and reflect on all
you've done, and the remarkable stability and service we've all
enjoyed for so long.

If you want to "punt" and just have accounts recreated, I'm personally
fine w/ that, if it's an option.

Cheers,

-bch
Post by Richard Hipp
Post by B Harder
I don't know what the definition of "recent" is, but I think my password
is same for months, wasn't working at time I sent last msg. I'll work with
you off-list if necessary.
I'm still working on the problem. I'll get it fixed as quickly as I can.
Sorry for the inconvenience.
--
D. Richard Hipp
--
Brad Harder
Method Logic Digital Consulting
http://www.methodlogic.net/
http://twitter.com/bcharder
Richard Hipp
2013-08-30 13:16:38 UTC
Permalink
Post by B Harder
Did this nuke accounts/passwords ?
All logins on the canonical Fossil repository should restored now.
--
D. Richard Hipp
***@sqlite.org
Stephan Beal
2013-08-30 13:31:48 UTC
Permalink
Post by Richard Hipp
All logins on the canonical Fossil repository should restored now.
out of curiosity: do you have a preferred/best-practice for partial db
restorations, or did you restore the whole db? How should a normal mortal,
without your inborn sqlite3 know-how, go about analyzing and recovering
from such a situation? This could be turned into a learning opportunity for
many sqlite users :).
--
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
Richard Hipp
2013-08-30 13:42:59 UTC
Permalink
Post by Stephan Beal
Post by Richard Hipp
All logins on the canonical Fossil repository should restored now.
out of curiosity: do you have a preferred/best-practice for partial db
restorations, or did you restore the whole db? How should a normal mortal,
without your inborn sqlite3 know-how, go about analyzing and recovering
from such a situation? This could be turned into a learning opportunity for
many sqlite users :).
If you have a clone, and you periodically run

fossil pull
fossil config pull all
kk
2013-09-01 17:31:52 UTC
Permalink
Post by Richard Hipp
On Fri, Aug 30, 2013 at 9:31 AM, Stephan Beal
On Fri, Aug 30, 2013 at 3:16 PM, Richard
Post by Richard Hipp
All logins on the canonical Fossil repository should
restored now.
out of curiosity: do you have a preferred/best-practice for
partial db restorations, or did you restore the whole db? How
should a normal mortal, without your inborn sqlite3 know-how,
go about analyzing and recovering from such a situation? This
could be turned into a learning opportunity for many sqlite
users:).
I don't know about sqlite users, but this thread is a great example
for new fossil users.
Post by Richard Hipp
If you have a clone, and you periodically run
fossil pull
fossil config pull all
Continue reading on narkive:
Loading...