You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Maris Orbidans <ma...@ingg.com> on 2009/03/11 18:17:06 UTC

SQLException: Page could not be read from disk

Sometimes insert fails with error message saying that a page could not
be read from disk.  We can't reproduce it but it has happened 3 times.
Any ideas what can cause this problem?


We use derby-10.4.1.3 in embedded mode.



org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [insert
into PERIOD_TOTALS(HO_LC_UNITID, opened, closed) values(?,?,?)]; SQL
state [XSDG0]; error code [45000]; Page Page(2,Container(0, 1072)) could
not be read from disk.; nested exception is java.sql.SQLException: Page
Page(2,Container(0, 1072)) could not be read from disk.
... 16 more
Caused by: java.sql.SQLException: Page Page(2,Container(0, 1072)) could
not be read from disk.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Un
known Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unkno
wn Source)
at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
Source)
at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
Source)
at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unkno
wn Source)
at
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
Source)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(Delega
tingPreparedStatement.java:102)
at
org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcT
emplate.java:773)
at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:566
)
... 21 more
Caused by: java.sql.SQLException: Java exception: ':
java.nio.channels.ClosedChannelException'.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
at
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Un
known Source)
... 31 more
Caused by: java.nio.channels.ClosedChannelException
at sun.nio.ch.FileChannelImpl.ensureOpen(Unknown Source)
at sun.nio.ch.FileChannelImpl.read(Unknown Source)



**********************************************************************
Confidentiality : This e-mail and any attachments are intended for the addressee only and may be confidential. If they come to you in error you must take no action based on them, nor must you copy or show them to anyone. Please advise the sender by replying to this e-mail immediately and then delete the original from your computer.

Opinion : Any opinions expressed in this e-mail are entirely those of the author and unless specifically stated to the contrary, are not necessarily those of the author�s employer.
 
Security Warning : Internet e-mail is not necessarily a secure communications medium and can be subject to data corruption. We advise that you consider this fact when e-mailing us. 

Viruses : We have taken steps to ensure that this e-mail and any attachments are free from known viruses but in keeping with good computing practice, you should ensure that they are virus free.

Inspired Gaming (UK) Limited
Registered in England No 3565640
Registered Office 3 The Maltings Wetmore Road, Burton On Trent, Staffordshire DE14 1SE
_______________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Control Centre.

RE: SQLException: Page could not be read from disk

Posted by Maris Orbidans <ma...@ingg.com>.
Yes, it seems that it was caused by interrupted thread. 
I added some code that clears interrupt status and it doesn't happen
again.



Caused by: org.springframework.dao.DataAccessResourceFailureException:
PreparedStatementCallback; SQL [insert into TOTALS(meter_name,
meter_value, HO_LC_UNITID, opened, closed) values(?,?,?,?,?)];
Connection closed by unknown interrupt.; nested exception is
java.sql.SQLException: Connection closed by unknown interrupt.
	at
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translat
e(SQLStateSQLExceptionTranslator.java:114)
...	... 35 more
Caused by: java.lang.InterruptedException
	at java.lang.Object.wait(Native Method)
	at
org.apache.derby.impl.services.locks.ActiveLock.waitForGrant(Unknown
Source)
	at
org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknow
n Source)


> -----Original Message-----
> From: Kristian.Waagan@Sun.COM [mailto:Kristian.Waagan@Sun.COM]
> Sent: 11 March 2009 17:35
> To: Derby Discussion
> Subject: Re: SQLException: Page could not be read from disk
> 
> Maris Orbidans wrote:
> > Sometimes insert fails with error message saying that a page could
not
> > be read from disk.  We can't reproduce it but it has happened 3
times.
> > Any ideas what can cause this problem?
> 
> Hello Maris,
> 
> Just a shot in the dark, but is there code in your software stack that
> calls Thread.interrupt()?
> This has caused problems before, I think one example was from a
> connection pool component.
> If this can be reproduced easily enough, you could try to switch to
the
> client driver, and see if the problem still happens. If not, it
> strengthens the interrupt-theory.
> 
> Also, which platform is this running on?
> 
> 
> Regards,
> --
> Kristian
> 
> >
> >
> > We use derby-10.4.1.3 in embedded mode.
> >
> >
> >
> > org.springframework.jdbc.UncategorizedSQLException:
> > PreparedStatementCallback; uncategorized SQLException for SQL
[insert
> > into PERIOD_TOTALS(HO_LC_UNITID, opened, closed) values(?,?,?)]; SQL
> > state [XSDG0]; error code [45000]; Page Page(2,Container(0, 1072))
could
> > not be read from disk.; nested exception is java.sql.SQLException:
Page
> > Page(2,Container(0, 1072)) could not be read from disk.
> > ... 16 more
> > Caused by: java.sql.SQLException: Page Page(2,Container(0, 1072))
could
> > not be read from disk.
> > at
> >
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> > Source)
> > at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
> > at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
> > at
> >
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Un
> > known Source)
> > at
> >
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unkno
> > wn Source)
> > at
org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
> > Source)
> > at
org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
> > Source)
> > at
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> > Source)
> > at
> >
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unkno
> > wn Source)
> > at
> >
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
> > Source)
> > at
> >
org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(Delega
> > tingPreparedStatement.java:102)
> > at
> >
org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcT
> > emplate.java:773)
> > at
> >
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:566
> > )
> > ... 21 more
> > Caused by: java.sql.SQLException: Java exception: ':
> > java.nio.channels.ClosedChannelException'.
> > at
> >
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> > Source)
> > at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown
Source)
> > at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
> > at
> >
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Un
> > known Source)
> > ... 31 more
> > Caused by: java.nio.channels.ClosedChannelException
> > at sun.nio.ch.FileChannelImpl.ensureOpen(Unknown Source)
> > at sun.nio.ch.FileChannelImpl.read(Unknown Source)
> >
> >
> >
> >
**********************************************************************
> > Confidentiality : This e-mail and any attachments are intended for
the
> addressee only and may be confidential. If they come to you in error
you
> must take no action based on them, nor must you copy or show them to
> anyone. Please advise the sender by replying to this e-mail
immediately
> and then delete the original from your computer.
> >
> > Opinion : Any opinions expressed in this e-mail are entirely those
of
> the author and unless specifically stated to the contrary, are not
> necessarily those of the author's employer.
> >
> > Security Warning : Internet e-mail is not necessarily a secure
> communications medium and can be subject to data corruption. We advise
> that you consider this fact when e-mailing us.
> >
> > Viruses : We have taken steps to ensure that this e-mail and any
> attachments are free from known viruses but in keeping with good
computing
> practice, you should ensure that they are virus free.
> >
> > Inspired Gaming (UK) Limited
> > Registered in England No 3565640
> > Registered Office 3 The Maltings Wetmore Road, Burton On Trent,
> Staffordshire DE14 1SE
> > _______________________________________________________________
> > This message has been checked for all known viruses by the
MessageLabs
> Virus Control Centre.
> 
> 
> _____________________________________________________________________
> This e-mail has been scanned for viruses by MessageLabs.

**********************************************************************
Confidentiality : This e-mail and any attachments are intended for the addressee only and may be confidential. If they come to you in error you must take no action based on them, nor must you copy or show them to anyone. Please advise the sender by replying to this e-mail immediately and then delete the original from your computer.

Opinion : Any opinions expressed in this e-mail are entirely those of the author and unless specifically stated to the contrary, are not necessarily those of the author�s employer.
 
Security Warning : Internet e-mail is not necessarily a secure communications medium and can be subject to data corruption. We advise that you consider this fact when e-mailing us. 

Viruses : We have taken steps to ensure that this e-mail and any attachments are free from known viruses but in keeping with good computing practice, you should ensure that they are virus free.

Inspired Gaming (UK) Limited
Registered in England No 3565640
Registered Office 3 The Maltings Wetmore Road, Burton On Trent, Staffordshire DE14 1SE
_______________________________________________________________
This message has been checked for all known viruses by the MessageLabs Virus Control Centre.

Re: SQLException: Page could not be read from disk

Posted by Kristian Waagan <Kr...@Sun.COM>.
Maris Orbidans wrote:
> Sometimes insert fails with error message saying that a page could not
> be read from disk.  We can't reproduce it but it has happened 3 times.
> Any ideas what can cause this problem?

Hello Maris,

Just a shot in the dark, but is there code in your software stack that 
calls Thread.interrupt()?
This has caused problems before, I think one example was from a 
connection pool component.
If this can be reproduced easily enough, you could try to switch to the 
client driver, and see if the problem still happens. If not, it 
strengthens the interrupt-theory.

Also, which platform is this running on?


Regards,
-- 
Kristian

> 
> 
> We use derby-10.4.1.3 in embedded mode.
> 
> 
> 
> org.springframework.jdbc.UncategorizedSQLException:
> PreparedStatementCallback; uncategorized SQLException for SQL [insert
> into PERIOD_TOTALS(HO_LC_UNITID, opened, closed) values(?,?,?)]; SQL
> state [XSDG0]; error code [45000]; Page Page(2,Container(0, 1072)) could
> not be read from disk.; nested exception is java.sql.SQLException: Page
> Page(2,Container(0, 1072)) could not be read from disk.
> ... 16 more
> Caused by: java.sql.SQLException: Page Page(2,Container(0, 1072)) could
> not be read from disk.
> at
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
> at org.apache.derby.impl.jdbc.Util.seeNextException(Unknown Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Un
> known Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unkno
> wn Source)
> at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown
> Source)
> at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unkno
> wn Source)
> at
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown
> Source)
> at
> org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(Delega
> tingPreparedStatement.java:102)
> at
> org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcT
> emplate.java:773)
> at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:566
> )
> ... 21 more
> Caused by: java.sql.SQLException: Java exception: ':
> java.nio.channels.ClosedChannelException'.
> at
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown
> Source)
> at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
> at org.apache.derby.impl.jdbc.Util.javaException(Unknown Source)
> at
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Un
> known Source)
> ... 31 more
> Caused by: java.nio.channels.ClosedChannelException
> at sun.nio.ch.FileChannelImpl.ensureOpen(Unknown Source)
> at sun.nio.ch.FileChannelImpl.read(Unknown Source)
> 
> 
> 
> **********************************************************************
> Confidentiality : This e-mail and any attachments are intended for the addressee only and may be confidential. If they come to you in error you must take no action based on them, nor must you copy or show them to anyone. Please advise the sender by replying to this e-mail immediately and then delete the original from your computer.
> 
> Opinion : Any opinions expressed in this e-mail are entirely those of the author and unless specifically stated to the contrary, are not necessarily those of the author’s employer.
>  
> Security Warning : Internet e-mail is not necessarily a secure communications medium and can be subject to data corruption. We advise that you consider this fact when e-mailing us. 
> 
> Viruses : We have taken steps to ensure that this e-mail and any attachments are free from known viruses but in keeping with good computing practice, you should ensure that they are virus free.
> 
> Inspired Gaming (UK) Limited
> Registered in England No 3565640
> Registered Office 3 The Maltings Wetmore Road, Burton On Trent, Staffordshire DE14 1SE
> _______________________________________________________________
> This message has been checked for all known viruses by the MessageLabs Virus Control Centre.


Re: SQLException: Page could not be read from disk

Posted by Daniel Noll <da...@nuix.com>.
Maris Orbidans wrote:
> Caused by: java.nio.channels.ClosedChannelException
> at sun.nio.ch.FileChannelImpl.ensureOpen(Unknown Source)
> at sun.nio.ch.FileChannelImpl.read(Unknown Source)

If this is on Windows, we have been plagued by this particular issue as 
well.  I put in additional code to re-open the channel if it was closed, 
and even with that it seemed like something was closing the channel 
underneath us.

Modifying BaseDataFileFactoryJ4 to return RAFContainer instead of 
RAFContainer4 avoided the problem for us.  Presumably there was a 
performance cost involved with switching to the older implementation though.

Daniel


-- 
Daniel Noll                            Forensic and eDiscovery Software
Senior Developer                              The world's most advanced
Nuix                                                email data analysis
http://nuix.com/                                and eDiscovery software