Bug #43634 Gopher crashes due to pread fails when trying to read beyond database file
Submitted: 13 Mar 2009 14:24 Modified: 23 Apr 2009 21:10
Reporter: Olav Sandstå Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Falcon storage engine Severity:S2 (Serious)
Version:6.0.11-alpha OS:Any
Assigned to: Vladislav Vaintroub CPU Architecture:Any
Tags: F_INDEX

[13 Mar 2009 14:24] Olav Sandstå
Description:
When running the RQG test falcon_tiny_insert one of the Gopher threads crashes due to a call to pread that returns 0. The error message is:

[Falcon] Error: pread on file /export/home/pb2/test/sb_1-389940-1236910720.83/mysql-6.0.11-alpha-linux-i686-test/vardirs/master-data/falcon_user.fts from  page 1016 (offset 4161536) returned 0 bytes instead of 4096 (possible read behind EOF)

This crash happens during the initial test phase when the test is running SQL commands against the server.

The call stack looks like:

Program terminated with signal 6, Aborted.
#0  0x00d8d402 in __kernel_vsyscall ()
#0  0x00d8d402 in __kernel_vsyscall ()
#1  0x0089f067 in pthread_kill () from /lib/libpthread.so.0
#2  0x0882c892 in my_write_core (sig=6) at stacktrace.c:309
#3  0x082beab2 in handle_segfault (sig=6) at mysqld.cc:2690
#4  <signal handler called>
#5  0x00d8d402 in __kernel_vsyscall ()
#6  0x008a2181 in raise () from /lib/libpthread.so.0
#7  0x085599fc in Error::debugBreak () at Error.cpp:94
#8  0x08559a78 in Error::error (
    string=0x89f02dc "pread on file %s from  page %d (offset %lld) returned %d bytes instead of %d (possible read behind EOF)") at Error.cpp:71
#9  0x085c5810 in IO::readPage (this=0xb736c8ec, bdb=0xb7251d3c) at IO.cpp:301
#10 0x0864d653 in Cache::fetchPage (this=0xb6ffca78, dbb=0xb736c8e8, 
    pageNumber=1016, pageType=PAGE_btree, lockType=Exclusive) at Cache.cpp:289
#11 0x085b39f4 in Dbb::fetchPage (this=0xb736c8e8, pageNumber=1016, 
    pageType=PAGE_btree, lockType=Exclusive) at Dbb.cpp:219
#12 0x085b3c28 in Dbb::handoffPage (this=0xb736c8e8, bdb=0xb72526cc, 
    pageNumber=1016, pageType=PAGE_btree, lockType=Exclusive) at Dbb.cpp:268
#13 0x085d17a4 in IndexRootPage::findInsertionLeaf (dbb=0xb736c8e8, indexId=0, 
    indexKey=0xb23ec708, recordNumber=1022, transId=0, isRoot=0x0)
    at IndexRootPage.cpp:311
#14 0x085d204c in IndexRootPage::indexMerge (dbb=0xb736c8e8, indexId=0, 
    logRecord=0xb23f20ec, transId=0) at IndexRootPage.cpp:828
#15 0x0861225d in SRLUpdateIndex::execute (this=0xb23f20ec)
    at SRLUpdateIndex.cpp:217
#16 0x08612307 in SRLUpdateIndex::commit (this=0xb23f20ec)
    at SRLUpdateIndex.cpp:195
#17 0x0862bf99 in SerialLogTransaction::commit (this=0xb7110300)
    at SerialLogTransaction.cpp:92
#18 0x0862c08f in SerialLogTransaction::doAction (this=0xb7110300)
    at SerialLogTransaction.cpp:158
#19 0x086561c6 in Gopher::gopherThread (this=0xb6ffdd68) at Gopher.cpp:71
#20 0x08656305 in Gopher::gopherThread (arg=0xb6ffdd68) at Gopher.cpp:37
#21 0x085829e1 in Thread::thread (this=0xb70083f8) at Thread.cpp:166
#22 0x08582bf1 in Thread::thread (parameter=0xb70083f8) at Thread.cpp:145
#23 0x0089a45b in start_thread () from /lib/libpthread.so.0
#24 0x007f1c4e in clone () from /lib/libc.so.6

How to repeat:
Seen once when running falcon_tiny_insert.

Suggested fix:
Avoid reading after EOF on the database file.
[13 Mar 2009 16:28] Kevin Lewis
Assigning to Vlad since this seems to have to do with the index structure.
[3 Apr 2009 7:51] John Embretsen
Note that the test falcon.falcon_bug_22173a has failed recently with this crash in Pushbuild 1 (see Bug#43765).
[14 Apr 2009 15:52] Vladislav Vaintroub
Bug#43474 is marked as duplicate of this one
[23 Apr 2009 21:10] Vladislav Vaintroub
Looks like temporarily glitch that was introduced with Bug#43765.
Has not failed recently.