You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Kathey Marsden <km...@sbcglobal.net> on 2008/01/25 19:32:56 UTC

Strange NPE in 10.1

I am working with a user who is getting a NullPointerException in 10.1.  
Below is the Derby
part of the trace:

   [1/24/08 14:25:59:741 EST] 0000002b SystemErr
 R java.lang.NullPointerException
org.apache.derby.iapi.jdbc.BrokeredConnection.newBrokeredStatement(BrokeredConnection.java:448)
org.apache.derby.jdbc.XAStatementControl.<init>(XAStatementControl.java:62)     
org.apache.derby.jdbc.EmbedXAConnection.wrapStatement(EmbedXAConnection.java:827)  

org.apache.derby.iapi.jdbc.BrokeredConnection.createStatement(BrokeredConnection.java:296)
....


Looking though at the code, I don't really see how we can get a NPE at 
this point.
    public BrokeredStatement 
newBrokeredStatement(BrokeredStatementControl statementControl) throws 
SQLException {
        return new BrokeredStatement(statementControl, getJDBCLevel());  
<< line 448
    }

I've been assured that we are not missing the top of the trace.  The 
issue is intermittent and it happens in a complex environment for which 
we don't have a simple repro at this point.  We've asked them to try 
with JIT turned off in case it is a JIT issue.  Any other thoughts on 
this error and how to debug?


Kathey


Re: Strange NPE in 10.1

Posted by Daniel John Debrunner <dj...@apache.org>.
Kathey Marsden wrote:

> Following the possible codepaths through the BrokeredStatement 
> constructor we could get to XAStatementControl.getRealStatement() which 
> might have a null xaconnection. I could try fixing DERBY-2142, if you 
> think it might be related. Seems a little like a shot in the dark since 
> they say they have only a single connection going at the time, but I 
> suppose it would be good to have that fixed anyway.

Even with a single connection there's a chance that multiple threads 
could be involved. There could be a thread that is performing the 
connection pool management, it gets the notification the connection has 
been closed by the application and then it executes statements to reset 
the physical connection to a known state. That kind of behaviour would 
hit DERBY-2142. No idea if that is actually happening in this case though.

Dan.


Re: Strange NPE in 10.1

Posted by Kathey Marsden <km...@sbcglobal.net>.
Daniel John Debrunner wrote:
> It could be the jit is messing up the line numbers for the NPE, 
> especially if it is in-lining code. Could the NPE be in the 
> BrokeredStatement constructor.
Here is the BrokeredStatement constructor:

BrokeredStatement(BrokeredStatementControl control, int jdbcLevel) 
throws SQLException
    {
        this.control = control;
        this.jdbcLevel = jdbcLevel;

        // save the state of the Statement while we are pretty much 
guaranteed the
        // underlying statement is open.
        resultSetType = getResultSetType();
        resultSetConcurrency = getResultSetConcurrency();

        resultSetHoldability = getResultSetHoldability();
    }

Following the possible codepaths through the BrokeredStatement 
constructor we could get to XAStatementControl.getRealStatement() which 
might have a null xaconnection. 
I could try fixing DERBY-2142, if you think it might be related. Seems a 
little like a shot in the dark since they say they have only a single 
connection going at the time, but I suppose it would be good to have 
that fixed anyway.

Kathey


Kathey


Re: Strange NPE in 10.1

Posted by Daniel John Debrunner <dj...@apache.org>.
Kathey Marsden wrote:
> Daniel John Debrunner wrote:
>>
>> Could it be DERBY-2142, which has a valid fix described.
>>
> Stan and I were looking at 2142, but for it to be that we would expect I 
> think the connection to be null and we have a dereference of it.  Here 
> our NPE comes at this line. How can we even get an NPE with this line of 
> code? Nothing is being dereferenced. I am sure I am being dense.
> 
> return new BrokeredStatement(statementControl, getJDBCLevel());

It could be the jit is messing up the line numbers for the NPE, 
especially if it is in-lining code. Could the NPE be in the 
BrokeredStatement constructor.

Dan.


Re: Strange NPE in 10.1

Posted by Kathey Marsden <km...@sbcglobal.net>.
Daniel John Debrunner wrote:
>
> Could it be DERBY-2142, which has a valid fix described.
>
Stan and I were looking at 2142, but for it to be that we would expect I 
think the connection to be null and we have a dereference of it.  Here 
our NPE comes at this line. How can we even get an NPE with this line of 
code? Nothing is being dereferenced. I am sure I am being dense.

return new BrokeredStatement(statementControl, getJDBCLevel());


Re: Strange NPE in 10.1

Posted by Daniel John Debrunner <dj...@apache.org>.
Kathey Marsden wrote:
> I am working with a user who is getting a NullPointerException in 10.1.  
> Below is the Derby
> part of the trace:
> 
>   [1/24/08 14:25:59:741 EST] 0000002b SystemErr
> R java.lang.NullPointerException
> org.apache.derby.iapi.jdbc.BrokeredConnection.newBrokeredStatement(BrokeredConnection.java:448) 
> 
> org.apache.derby.jdbc.XAStatementControl.<init>(XAStatementControl.java:62)     
> org.apache.derby.jdbc.EmbedXAConnection.wrapStatement(EmbedXAConnection.java:827)  
> 
> org.apache.derby.iapi.jdbc.BrokeredConnection.createStatement(BrokeredConnection.java:296) 
> 
> ....
> 
> 
> Looking though at the code, I don't really see how we can get a NPE at 
> this point.
>    public BrokeredStatement 
> newBrokeredStatement(BrokeredStatementControl statementControl) throws 
> SQLException {
>        return new BrokeredStatement(statementControl, getJDBCLevel());  
> << line 448
>    }
> 
> I've been assured that we are not missing the top of the trace.  The 
> issue is intermittent and it happens in a complex environment for which 
> we don't have a simple repro at this point.  We've asked them to try 
> with JIT turned off in case it is a JIT issue.  Any other thoughts on 
> this error and how to debug?

Could it be DERBY-2142, which has a valid fix described.

Dan.

Re: Strange NPE in 10.1

Posted by Kathey Marsden <km...@sbcglobal.net>.
Kathey Marsden wrote:
> I am working with a user who is getting a NullPointerException in 
> 10.1.  Below is the Derby
> part of the trace:
The 10.1 version is:   10.1.3.2 - (601970)