[ 
https://issues.apache.org/jira/browse/DERBY-4794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12907056#action_12907056
 ] 

Bryan Pendleton commented on DERBY-4794:
----------------------------------------

It looks like the exception traces that you are posting are from a secondary 
exception.

That is, the statement that you are executing seems to be getting an exception
and trying to handle it:


    at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
Source) 
    at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown 
Source) 


And then, during the attempt to handle that exception, you are getting a 
secondary
exception in BasicNoPutResultSetImpl.finishAndRTS()

>From a quick scan of the code, it looks like the only way you could get an NPE 
>in
that method is if "activation" is NULL. There is at least one other place in the
BasicNoPutResultSetImpl.java code where it checks (activation != null), so it 
looks
like it is possible for activation to be NULL, and we should probably have a 
check
for that in finishAndRTS().

If you are experiencing these crashes regularly, you could try applying a patch
such as the following, and see whether it changes the behavior that you see at 
all.

Index: 
java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java
===================================================================
--- java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java  
(revision 991055)
+++ java/engine/org/apache/derby/impl/sql/execute/BasicNoPutResultSetImpl.java  
(working copy)
@@ -621,7 +621,7 @@
 
                        finished = true;
 
-                       if (isTopResultSet && activation.isSingleExecution())
+                       if (isTopResultSet && activation != null && 
activation.isSingleExecution())
                                activation.close();
                }
        }



> NPE at org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finishAndRTS 
> ------------------------------------------------------------------------------
>
>                 Key: DERBY-4794
>                 URL: https://issues.apache.org/jira/browse/DERBY-4794
>             Project: Derby
>          Issue Type: Bug
>          Components: Miscellaneous
>         Environment: Derby version info -- as seen in MANIFEST.MF
> Manifest-Version: 1.0
> Ant-Version: Apache Ant 1.6.5
> Created-By: 1.4.2_12-b03 (Sun Microsystems Inc.)
> Bundle-Vendor: Apache Software Foundation
> Bundle-Name: Apache Derby 10.3
> Bundle-Version: 10.3.1000004.561794
> Sealed: true
>            Reporter: Manoranjan Sahu
>
> Derby is throwing NPE randomly while executing simple sql statements. 
> Stack trace in derby.log
> Caused by: java.sql.SQLException: Java exception: ': 
> java.lang.NullPointerException'.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.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(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> 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(Unknown 
> Source)
>       at 
> org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeQuery(Unknown Source)
>       at 
> oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:726)
>       at 
> oracle.toplink.essentials.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:501)
>       ... 58 more
> Caused by: java.sql.SQLException: Java exception: ': 
> java.lang.NullPointerException'.
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
>       at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown
>  Source)
>       ... 70 more
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.derby.impl.sql.execute.BasicNoPutResultSetImpl.finishAndRTS(Unknown
>  Source)
>       at 
> org.apache.derby.impl.sql.execute.ProjectRestrictResultSet.finish(Unknown 
> Source)
>       at org.apache.derby.impl.sql.execute.BaseActivation.close(Unknown 
> Source)
>       at org.apache.derby.impl.sql.GenericActivationHolder.execute(Unknown 
> Source)
>       at org.apache.derby.impl.sql.GenericPreparedStatement.execute(Unknown 
> Source)
>       ... 63 more
> It is noticed that this issue is happening randomly , during selects and 
> inserts. I did not find any quick reproduction steps for it.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to