db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Nobelis <nicolas.nobe...@blue-elephant-systems.com>
Subject Re: EOFException with latest release
Date Wed, 06 Jul 2011 10:02:29 GMT
Hello Rick,

Thanks for your reply. I did some tests today and this seems indeed to 
be a primary key / index corruption but only after server shutdown and 
restart.

However, the primary key of the outage table is not always the entity 
affected. Once, it was the outageInfraIdx index that was corrupted, 
another time the primary key of the outage.backend table.
After dropping and redeclaring these entities, the queries are working 
again.

I'll try to write a small script to exhibit this behaviour, albeit this 
error seems to be a race condition and thus quite hard to trigger.

Best regards,

Nicolas

Le 05/07/2011 17:10, Rick Hillegas a écrit :
> Hi Nicolas,
>
> Might be a corrupt primary key. Can you try dropping and redeclaring the
> primary key on the outage table? Do you have a script which reliably
> recreates this problem? That would help us track down the original
> corruption.
>
> Thanks,
> -Rick
>
> On 7/5/11 7:56 AM, Nicolas Nobelis wrote:
>> Hello all,
>>
>> Sorry if my error is well-know, but I did an intensive search the last
>> days and nothing came up, except some old 10.1 bugs.
>>
>> I'm using derby-10.8.1.2 on HP-UX (JVM 1.6.0.08) in Network Server Mode.
>>
>> I have three tables with several foreign key dependencies and several
>> indexes (shema underneath).
>> I start the server and I insert 2500 entries in the outage table, 500
>> in the request one and 250 in the service one. Then I shutdown the
>> server and restart it.
>>
>> After the restart, some SELECT queries fire a EOFException :
>>
>>> ??????????????????.??????-651050311255851044{5}), Cleanup action starting
>>> Tue Jul 05 16:21:45 CEST 2011
>>> Thread[DRDAConnThread_49,5,derby.daemons] (XID = 18273), (SESSIONID =
>>> 50), (DATABASE = outage), (DRDAID =
>>> ????????????????????????.??????-651050311255851044{5}), Failed Statement is:
select
>>> outage.id from outage.outage AS outage WHERE  outage.Id = 1
>>> ERROR XSDA7: Restore of a serializable or SQLData object of class ,
>>> attempted to read more data than was originally stored
>>>          at
>>> org.apache.derby.iapi.error.StandardException.newException(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.ControlRow.compareIndexRowFromPageToKey(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.ControlRow.searchForEntry(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BranchControlRow.search(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BTreeScan.positionAtStartForForwardScan(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BTreeForwardScan.positionAtStartPosition(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BTreeScan.fetchNext(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.sql.execute.TableScanResultSet.getNextRowCore(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source)
>>>          at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.drda.DRDAConnThread.writeFDODTA(Unknown Source)
>>>          at
>>> org.apache.derby.impl.drda.DRDAConnThread.writeQRYDTA(Unknown Source)
>>>          at
>>> org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown
>>> Source)
>>>          at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
>>> Caused by: java.io.EOFException
>>>          at
>>> org.apache.derby.iapi.services.io.ArrayInputStream.readInt(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.iapi.types.SQLInteger.readExternalFromArray(Unknown
>>> Source)
>>>          ... 18 more
>>> ============= begin nested exception, level (1) ===========
>>> java.io.EOFException
>>>          at
>>> org.apache.derby.iapi.services.io.ArrayInputStream.readInt(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.iapi.types.SQLInteger.readExternalFromArray(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.raw.data.StoredPage.readRecordFromArray(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.raw.data.StoredPage.restoreRecordFromSlot(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.raw.data.BasePage.fetchFromSlot(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.ControlRow.compareIndexRowFromPageToKey(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.ControlRow.searchForEntry(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BranchControlRow.search(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BTreeScan.positionAtStartForForwardScan(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BTreeForwardScan.positionAtStartPosition(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BTreeForwardScan.fetchRows(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.store.access.btree.BTreeScan.fetchNext(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.sql.execute.TableScanResultSet.getNextRowCore(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.getNextRow(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.jdbc.EmbedResultSet.movePosition(Unknown Source)
>>>          at org.apache.derby.impl.jdbc.EmbedResultSet.next(Unknown
>>> Source)
>>>          at
>>> org.apache.derby.impl.drda.DRDAConnThread.writeFDODTA(Unknown Source)
>>>          at
>>> org.apache.derby.impl.drda.DRDAConnThread.writeQRYDTA(Unknown Source)
>>>          at
>>> org.apache.derby.impl.drda.DRDAConnThread.processCommands(Unknown
>>> Source)
>>>          at org.apache.derby.impl.drda.DRDAConnThread.run(Unknown Source)
>>> ============= end nested exception, level (1) ===========
>>> Cleanup action completed
>>
>> I did some some tinkering and some queries throw the exception, some
>> don't.
>> Exception :
>> select outage.id from outage.outage AS outage WHERE  outage.Id = 1
>> select outage.* from outage.outage AS outage WHERE  outage.Id = 1
>> No exception :
>> select outage.id from outage.outage AS outage
>> select outage.* from outage.outage AS outage
>> select * from outage.outage AS outage WHERE id IS NOT NULL
>>
>> Since the exception occurs only with some specific where clauses, I
>> tend to think that these errors are index-related, but I'm really no
>> specialist.
>>
>> Can somebody familiar with derby internals tell me when such an
>> exception is thrown or, even better, how to fix it ?
>>
>> Thanks a lot for any help,
>>
>> Table schema follows.
>>
>> Best regards,
>>
>> Nicolas
>>
>> Schema :
>> create table outage.backend (
>>    id INT not null generated always as identity,
>>    name varchar(256) NOT NULL UNIQUE,
>>    PRIMARY KEY (id)
>> );
>>
>> create table outage.service (
>>    id INT not null generated always as identity,
>>    name varchar(256) NOT NULL,
>>    backend_id INT NOT NULL,
>>    definition XML,
>>    deleted SMALLINT NOT NULL DEFAULT 0,
>>    status INT NOT NULL DEFAULT 0,
>>    description varchar(512),
>>    PRIMARY KEY (id),
>>    FOREIGN KEY (backend_id) REFERENCES outage.backend ON DELETE CASCADE,
>>    CONSTRAINT svc_name_backend UNIQUE (name, backend_id)
>> );
>> CREATE INDEX serviceNameIdx on outage.service (name);
>> CREATE INDEX serviceDeletedIdx on outage.service (deleted);
>> CREATE INDEX serviceStatusIdx on outage.service (status);
>>
>> CREATE TABLE outage.request (
>>    id INT not null generated always as identity,
>>    extern_id varchar(128) DEFAULT NULL,
>>    owner VARCHAR(50) NOT NULL,
>>    service_id INT NOT NULL,
>>    backend_id INT NOT NULL,
>>    start_time TIMESTAMP,
>>    end_time TIMESTAMP,
>>    dirty SMALLINT NOT NULL DEFAULT 0,
>>    deleted SMALLINT NOT NULL DEFAULT 0,
>>    status INT NOT NULL DEFAULT 1,
>>    comment VARCHAR(1024) NOT NULL,
>>    FOREIGN KEY (service_id) REFERENCES outage.service ON DELETE CASCADE,
>>    FOREIGN KEY (backend_id) REFERENCES outage.backend ON DELETE CASCADE,
>>    PRIMARY KEY (id)
>> );
>> CREATE INDEX reqDeletedIdx on outage.request (deleted);
>> CREATE INDEX reqStatusIdx on outage.request (status);
>>
>> CREATE TABLE outage.outage (
>>    id INT not null generated always as identity,
>>    request_id INT NOT NULL,
>>    service_id INT NOT NULL,
>>    backend_id INT NOT NULL,
>>    start_time TIMESTAMP,
>>    end_time TIMESTAMP,
>>    end_owner VARCHAR (50),
>>    deleted SMALLINT NOT NULL DEFAULT 0,
>>    infrastructure SMALLINT NOT NULL DEFAULT 0,
>>    status INT NOT NULL DEFAULT 1,
>>    node_name VARCHAR (1024) NOT NULL,
>>    FOREIGN KEY (service_id) REFERENCES outage.service ON DELETE CASCADE,
>>    FOREIGN KEY (request_id) REFERENCES outage.request ON DELETE CASCADE,
>>    FOREIGN KEY (backend_id) REFERENCES outage.backend ON DELETE CASCADE,
>>    PRIMARY KEY (id)
>> );
>> CREATE INDEX outageNodeNameIdx on outage.outage (node_name);
>> CREATE INDEX outageDeletedIdx on outage.outage (deleted);
>> CREATE INDEX outageInfraIdx on outage.outage (infrastructure);
>> CREATE INDEX outageStatusIdx on outage.outage (status);
>>
>

Mime
View raw message