Yuliana Ganchevska created DERBY-7158:
-----------------------------------------
Summary: ArrayIndexOutOfBoundsException when connecting to
Embedded Derby
Key: DERBY-7158
URL: https://issues.apache.org/jira/browse/DERBY-7158
Project: Derby
Issue Type: Bug
Affects Versions: 10.14.2.0
Reporter: Yuliana Ganchevska
Hello,
our project is using Embedded Derby 10.14.2 with Java 11. A client recently
complained they can't connect to the DB and it seems the DB is corrupted. At
the time the issue happened they said the only change they made was to increase
the memory. When the application is trying to connect to the DB, it throws the
following exception:
{code:java}
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for
length 28
at org.apache.derby.impl.store.raw.data.BasePage.getHeaderAtSlot(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.data.BasePage.setDeleteStatus(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.data.CachedPage.setDeleteStatus(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.data.StoredPage.setDeleteStatus(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.data.InsertOperation.undoMe(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.data.LogicalUndoOperation.doMe(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.log.FileLogger.logAndUndo(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.xact.Xact.logAndUndo(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.log.FileLogger.undo(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.xact.Xact.abort(Unknown Source)
~[derby-10.14.2.jar:?]
at
org.apache.derby.impl.store.raw.xact.XactFactory.rollbackAllTransactions(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.log.LogToFile.recover(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.raw.RawStore.boot(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.access.RAMAccessManager$5.run(Unknown
Source) ~[derby-10.14.2.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at
org.apache.derby.impl.store.access.RAMAccessManager.bootServiceModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.store.access.RAMAccessManager.boot(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.BaseMonitor.startModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.FileMonitor.startModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.iapi.services.monitor.Monitor.bootServiceModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.db.BasicDatabase$5.run(Unknown Source)
~[derby-10.14.2.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.apache.derby.impl.db.BasicDatabase.bootServiceModule(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.db.BasicDatabase.bootStore(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.db.BasicDatabase.boot(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.BaseMonitor.boot(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.TopService.bootModule(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.services.monitor.BaseMonitor.bootService(Unknown
Source) ~[derby-10.14.2.jar:?]
at
org.apache.derby.impl.services.monitor.BaseMonitor.startProviderService(Unknown
Source) ~[derby-10.14.2.jar:?]
at
org.apache.derby.impl.services.monitor.BaseMonitor.findProviderAndStartService(Unknown
Source) ~[derby-10.14.2.jar:?]
at
org.apache.derby.impl.services.monitor.BaseMonitor.startPersistentService(Unknown
Source) ~[derby-10.14.2.jar:?]
at
org.apache.derby.iapi.services.monitor.Monitor.startPersistentService(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.jdbc.EmbedConnection$4.run(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.jdbc.EmbedConnection$4.run(Unknown Source)
~[derby-10.14.2.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at
org.apache.derby.impl.jdbc.EmbedConnection.startPersistentService(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.impl.jdbc.EmbedConnection.bootDatabase(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.jdbc.InternalDriver$1.run(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.jdbc.InternalDriver$1.run(Unknown Source)
~[derby-10.14.2.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.apache.derby.jdbc.InternalDriver.getNewEmbedConnection(Unknown
Source) ~[derby-10.14.2.jar:?]
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.jdbc.InternalDriver.connect(Unknown Source)
~[derby-10.14.2.jar:?]
at org.apache.derby.jdbc.EmbeddedDriver.connect(Unknown Source)
~[derby-10.14.2.jar:?]
at
org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:346)
~[org.apache.tomcat.jdbc_8.5.85.jar:?]
at
org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:227)
~[org.apache.tomcat.jdbc_8.5.85.jar:?]
at
org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:763)
~[org.apache.tomcat.jdbc_8.5.85.jar:?]
at
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:691)
~[org.apache.tomcat.jdbc_8.5.85.jar:?]
at
org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:197)
~[org.apache.tomcat.jdbc_8.5.85.jar:?]
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:134)
~[org.apache.tomcat.jdbc_8.5.85.jar:?]
at
org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIConnector.java:138)
~[eclipselink-2.7.10.jar:2.7.10.v20211216-fe64cd39c3]
at
org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:172)
~[eclipselink-2.7.10.jar:2.7.10.v20211216-fe64cd39c3]
at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:225)
~[eclipselink-2.7.10.jar:2.7.10.v20211216-fe64cd39c3]
at
org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:809)
~[eclipselink-2.7.10.jar:2.7.10.v20211216-fe64cd39c3]
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:261)
~[eclipselink-2.7.10.jar:2.7.10.v20211216-fe64cd39c3]
at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:773)
~[eclipselink-2.7.10.jar:2.7.10.v20211216-fe64cd39c3]
... 23 more {code}
Using the shared Java class from
https://issues.apache.org/jira/browse/DERBY-5201 with option "-v" I was able to
see there are two .dat files with INVALID_PAGE flag in the page header. One of
them is for our custom table and the other is for SYSSTATISTICS.
I saw in the documentation that if backup is created and with logs, the DB
could be restored, but unfortunately we don't have backup.
Is it still possible to connect to the DB somehow?
Also could increasing the memory interfere with the Derby DB and corrupt it?
Regards,
Yuliana
--
This message was sent by Atlassian Jira
(v8.20.10#820010)