[ https://issues.apache.org/jira/browse/DERBY-7156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17757619#comment-17757619 ]
Richard N. Hillegas commented on DERBY-7156: -------------------------------------------- The comments in BasePage.setExclusive() suggest that the latching implementation could be made more robust at the cost of more object creation on the inner loop. This is tricky code outside my area of expertise. > ERROR XSDAO: Internal error: Page attempted latched twice when executing > parallel accesses to the same binary column > -------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-7156 > URL: https://issues.apache.org/jira/browse/DERBY-7156 > Project: Derby > Issue Type: Bug > Components: Store > Affects Versions: 10.15.1.3, 10.15.2.0, 10.16.1.1 > Environment: OS name: Windows 10 > OS architecture: amd64 > OS version: 10.0 > Java Version: 17.0.7 > Java Vendor: Eclipse Adoptium > Reporter: Sergio Cruz > Priority: Major > Attachments: TestTx.java, derby.log, sysinfo.txt > > > {{When executing parallel _SELECT_ statements accessing to a table with a > binary column, sometimes an error indicating that a page was attempted > latched twice is received while reading the value of the binary column.}} > > {{This error _ERROR XSDAO: Internal error: page Page(334,Container(0, 1456)) > attempted latched twice_ is received when connection is inside a > transaction.}} > {{In case the connection is not in a transaction, the error is different: > _ERROR 40XD0: Container has been closed_}} > > I attach a Java class for reproducing the issue. It has the following lines > for testing both versions of the error > {code:java} > //conn.setAutoCommit(true); //ERROR 40XD0: Container has been closed. > conn.setAutoCommit(false); //ERROR XSDAO: Internal error: page > Page(334,Container(0, 1392)) attempted latched twice. {code} > This is an example of the received error. > > {noformat} > Exception in thread "pool-1-thread-1" java.lang.RuntimeException: > java.io.IOException: ERROR XSDAO: Internal error: page Page(334,Container(0, > 1456)) attempted latched twice. > at org.scruz.derby.TestTx$Access.run(TestTx.java:60) > at > java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) > at > java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) > at java.base/java.lang.Thread.run(Thread.java:833) > Caused by: java.io.IOException: ERROR XSDAO: Internal error: page > Page(334,Container(0, 1456)) attempted latched twice. > at > org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:168) > at > org.apache.derby.impl.store.raw.data.BufferedByteHolderInputStream.read(BufferedByteHolderInputStream.java:37) > at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82) > at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82) > at java.base/java.io.FilterInputStream.read(FilterInputStream.java:82) > at > org.apache.derby.iapi.services.io.CloseFilterInputStream.read(CloseFilterInputStream.java:60) > at org.scruz.derby.TestTx$Access.run(TestTx.java:55) > ... 3 more > Caused by: ERROR XSDAO: Internal error: page Page(334,Container(0, 1456)) > attempted latched twice. > at > org.apache.derby.shared.common.error.StandardException.newException(StandardException.java:300) > at > org.apache.derby.shared.common.error.StandardException.newException(StandardException.java:295) > at > org.apache.derby.impl.store.raw.data.BasePage.setExclusive(BasePage.java:1710) > at > org.apache.derby.impl.store.raw.data.BaseContainer.latchPage(BaseContainer.java:527) > at > org.apache.derby.impl.store.raw.data.FileContainer.latchPage(FileContainer.java:3532) > at > org.apache.derby.impl.store.raw.data.FileContainer.getUserPage(FileContainer.java:2551) > at > org.apache.derby.impl.store.raw.data.FileContainer.getPage(FileContainer.java:2593) > at > org.apache.derby.impl.store.raw.data.BaseContainerHandle.getPage(BaseContainerHandle.java:319) > at > org.apache.derby.impl.store.raw.data.OverflowInputStream.fillByteHolder(OverflowInputStream.java:151) > ... 9 more{noformat} > -- This message was sent by Atlassian Jira (v8.20.10#820010)