You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/07/29 10:07:18 UTC

DO NOT REPLY [Bug 51582] New: NPE in SlowQueryReport

https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

             Bug #: 51582
           Summary: NPE in SlowQueryReport
           Product: Tomcat Modules
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: jdbc-pool
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: patric@rufflar.com
    Classification: Unclassified


java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
    at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.getQueryStats(SlowQueryReport.java:156)
    at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:85)
    at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx.reportFailedQuery(SlowQueryReportJmx.java:147)
    at
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:236)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #6 from Patric Rufflar <pa...@rufflar.com> 2011-10-27 20:14:28 UTC ---
Hi Filip,

here is an extended stacktrace of comment #0, however I truncated the lower
stack trace elements.

> (In reply to comment #0)

Note: As the name implies, CStatement.cancel() calls cancel() on the
jdbc-pool's Proxy of the jdbc Statement.


java.lang.NullPointerException
        at
java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
        at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.getQueryStats(SlowQueryReport.jav
a:156)
        at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport
.java:85)
        at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx.reportFailedQuery(SlowQueryRep
ortJmx.java:147)
        at
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(Abstrac
tQueryReport.java:236)
        at $Proxy96.cancel(Unknown Source)
        at my.product.jdbc.CStatement.cancel(CStatement.java:97)



BTW: What about the NPE in comment #1? It's unlikely that this exception
related to a null sql query.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

Patric Rufflar <pa...@rufflar.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major

--- Comment #3 from Patric Rufflar <pa...@rufflar.com> 2011-10-12 13:54:12 UTC ---
And also another one (most probably they all have the same cause).

java.lang.NullPointerException
 at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportSlowQuery(SlowQueryReport.j
ava:96)
 at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx.reportSlowQuery(SlowQueryRepor
tJmx.java:181)
 at
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(Abstrac
tQueryReport.java:250)
 at $Proxy104.executeQuery(Unknown Source)


We're seeing this issue pretty often - is there an estimation when it is going
to be fixed?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #1 from Patric Rufflar <pa...@rufflar.com> 2011-08-12 14:10:40 UTC ---
Another one:

java.lang.NullPointerException
    at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:86)
    at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx.reportFailedQuery(SlowQueryReportJmx.java:147)
    at
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:236)
    at $Proxy7.executeQuery(Unknown Source)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

Rob Moore <ro...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rob.moore+apache@gmail.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #9 from Patric Rufflar <pa...@rufflar.com> 2012-01-27 09:22:10 UTC ---
Created attachment 28218
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28218
test application to reproduce the bug

This test application will do concurrently
- execute a statement
- cancel it
- close the connection

and repeat those steps infinitely.

On my machine, I am seeing the NPE every 5 seconds with this application.
(tested with oracle jdbc driver and database)
Please note, that you have to adjust user/pass/url/query.

The connection.close() is the source of the issue, which sets the query
concurrent hash map to null.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #4 from Filip Hanik <fh...@apache.org> 2011-10-27 19:47:47 UTC ---
(In reply to comment #0)
> java.lang.NullPointerException
>     at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768)
>     at
> org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.getQueryStats(SlowQueryReport.java:156)
>     at
> org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:85)
>     at
> org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx.reportFailedQuery(SlowQueryReportJmx.java:147)
>     at
> org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:236)


This error implies the SQL is null. Do you have a full stack trace for this
one?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #7 from Filip Hanik <fh...@apache.org> 2011-12-02 01:04:49 UTC ---
(In reply to comment #6)

> 
> BTW: What about the NPE in comment #1? It's unlikely that this exception
> related to a null sql query.

hi Patric, I think it is very likely, the statement is

            QueryStats qs = this.getQueryStats(sql);
            qs.failure(delta, now);  <-- NPE here

if SQL is null, the qs variable is also null

Filip

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #12 from Filip Hanik <fh...@apache.org> 2012-02-13 20:38:02 UTC ---
Fixed in r1243682 for the Tomcat 7 branch

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #8 from Patric Rufflar <pa...@rufflar.com> 2012-01-26 18:04:42 UTC ---
Hi Filip,

I was able to debug the NPE situation (during a load test):
sql is suprisingly _not_ null, but SlowQueryReport.this.queries is:

    protected QueryStats getQueryStats(String sql) {
        ConcurrentHashMap<String,QueryStats> queries =
SlowQueryReport.this.queries;
        if (queries==null) return null;    <-- null is returned here
...

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #5 from Filip Hanik <fh...@apache.org> 2011-10-27 20:01:18 UTC ---
Patrick, in r1189978 this has been fixed. However, if you could post a full
stack trace so I can figure out why there is no 'sql' string present, ie, I've
missed a call that doesn't call

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #11 from Patric Rufflar <pa...@rufflar.com> 2012-02-13 19:42:40 UTC ---
Thanks, Filip and welcome back.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

--- Comment #2 from Patric Rufflar <pa...@rufflar.com> 2011-08-12 14:15:43 UTC ---
Both exceptions seems to be caused due to race conditions (one thread is
executing a statement, while another one is canceling it and possibly closing
the ProxyConnection)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 51582] NPE in SlowQueryReport

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51582

Filip Hanik <fh...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #10 from Filip Hanik <fh...@apache.org> 2012-02-13 19:08:19 UTC ---
Fixed in r1243655
it was setting the query cache to null when the connection was returned to the
pool instead of when the connection was actually closed

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org