[ 
https://issues.apache.org/jira/browse/DERBY-6038?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Anders Hatlen updated DERBY-6038:
--------------------------------------

    Attachment: d6038-1a-close-rs.diff

One of the test cases for DERBY-3304 calls a stored Java procedure that raises 
an exception. The comments in the test case indicate that it expected all open 
result sets produced in the stored procedure to be closed automatically when 
the exception is raised. However, the fix for DERBY-3304 only ensured that the 
CallStatementResultSet and all of its dynamic result sets would be closed 
automatically if the procedure failed. It would give the impression of having 
closed the other result sets opened in the procedure, because gc would in most 
cases close them implicitly before the table was attempted dropped, but not 
always.

The attached patch makes the procedure close the non-dynamic result set 
explicitly to prevent the intermittent failure. It also updates the comments to 
say that the fix for DERBY-3304 only affected the internal 
CallStatementResultSet and the dynamic result sets in the procedure. This makes 
the test run cleanly in my environment, also with the JVM switch that reliably 
reproduced the failure.
                
> Intermittent failure in LangProcedureTest: cannot drop table because of open 
> ResultSet
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-6038
>                 URL: https://issues.apache.org/jira/browse/DERBY-6038
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.10.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: d6038-1a-close-rs.diff
>
>
> Seen intermittently after LangProcedureTest was enabled:
> 1) 
> testDynamicResultSets(org.apache.derbyTesting.functionTests.tests.lang.LangProcedureTest)java.sql.SQLException:
>  Operation 'DROP TABLE' cannot be performed on object 'DELLATER3' because 
> there is an open ResultSet dependent on that object.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:98)
>       at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:256)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:424)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:353)
>       at 
> org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2400)
>       at 
> org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:82)
>       at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1334)
>       at 
> org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:630)
>       at 
> org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:559)
>       at 
> org.apache.derbyTesting.functionTests.tests.lang.LangProcedureTest.testDynamicResultSets(LangProcedureTest.java:976)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
>       at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:424)
>       at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:441)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
>       at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
> Caused by: java.sql.SQLException: Operation 'DROP TABLE' cannot be performed 
> on object 'DELLATER3' because there is an open ResultSet dependent on that 
> object.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:42)
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:122)
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
>       ... 47 more
> Caused by: ERROR X0X95: Operation 'DROP TABLE' cannot be performed on object 
> 'DELLATER3' because there is an open ResultSet dependent on that object.
>       at 
> org.apache.derby.iapi.error.StandardException.newException(StandardException.java:295)
>       at 
> org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.verifyNoOpenResultSets(GenericLanguageConnectionContext.java:2146)
>       at 
> org.apache.derby.impl.sql.GenericPreparedStatement.prepareToInvalidate(GenericPreparedStatement.java:778)
>       at 
> org.apache.derby.impl.sql.depend.BasicDependencyManager.coreInvalidateFor(BasicDependencyManager.java:437)
>       at 
> org.apache.derby.impl.sql.depend.BasicDependencyManager.invalidateFor(BasicDependencyManager.java:298)
>       at 
> org.apache.derby.impl.sql.execute.DropTableConstantAction.executeConstantAction(DropTableConstantAction.java:265)
>       at 
> org.apache.derby.impl.sql.execute.MiscResultSet.open(MiscResultSet.java:61)
>       at 
> org.apache.derby.impl.sql.GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:452)
>       at 
> org.apache.derby.impl.sql.GenericPreparedStatement.execute(GenericPreparedStatement.java:333)
>       at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1242)
>       ... 41 more

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to