You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tomasz Kowalczewski <to...@gmail.com> on 2013/04/02 14:15:32 UTC

NPE in SlowQuery

Hello all,

we are running Tomcat 7 on Amazon EC2:

Server version: Apache Tomcat/7.0.22
Server built:   Sep 27 2011 09:40:50
Server number:  7.0.22.0
OS Name:        Linux
OS Version:     2.6.34.7-56.40.amzn1.i686
Architecture:   i386
JVM Version:    1.7.0_03-b04

And get following exception on slow queries:

[catalina-exec-18] 04-02 10:27:11 ERROR TransactionInterceptor:414 -
Application exception overridden by rollback exception
java.lang.NullPointerException
               at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:86)
               at
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:237)

I wasn't able to google for a solution/bugfix therefore I would like
to ask the Tomcat community for help on this issue. Is this a known
bug?

When looking at the source code:

85:  QueryStats qs = this.getQueryStats(sql);
86:  qs.failure(delta, now);

It looks like getQueryStats(sql) returned null and indeed it does so
on at leas one ocassion:

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

However, non of the uses of getQueryStats() in SlowQueryReport guard
against this null. It seems to be a bug.

--
Regards,
Tomasz Kowalczewski

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


Re: NPE in SlowQuery

Posted by Daniel Mikusa <dm...@gopivotal.com>.
On May 20, 2013, at 10:17 AM, Tomasz Kowalczewski wrote:

> Hi,
> 
> when first reporting this issue I was mistaken about the configuration.
> Although we use an older tomcat version, the tomcat-jdbc is pulled into our
> application as a separate dependency. I have upgraded it to newest version
> (7.0.39) and still see similar exception happening:
> 
> [http-bio-8080-exec-208] 05-16 17:16:25 ERROR TransactionInterceptor:414 -
> Application exception overridden by rollback exception
> java.lang.NullPointerException
> 
>               at
> org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:89)
> 
>               at
> org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:237)
> 
>               at $Proxy238.executeQuery(Unknown Source)

If you can reproduce with the latest version, then you might want to open a bug.  Test cases and patches are always welcome.

Dan


> 
> On Tue, Apr 2, 2013 at 2:59 PM, Tomasz Kowalczewski <
> tomasz.kowalczewski@gmail.com> wrote:
> 
>> On Tue, Apr 2, 2013 at 2:43 PM, Daniel Mikusa <dm...@vmware.com> wrote:
>> 
>>> On Apr 2, 2013, at 8:15 AM, Tomasz Kowalczewski wrote:
>>> 
>>>> Hello all,
>>>> 
>>>> we are running Tomcat 7 on Amazon EC2:
>>>> 
>>>> Server version: Apache Tomcat/7.0.22
>>>> Server built:   Sep 27 2011 09:40:50
>>>> Server number:  7.0.22.0
>>> 
>>> As you can see from the date, this version is getting to be pretty old.
>>> You should consider upgrading.
>>> 
>>>> OS Name:        Linux
>>>> OS Version:     2.6.34.7-56.40.amzn1.i686
>>>> Architecture:   i386
>>>> JVM Version:    1.7.0_03-b04
>>>> 
>>>> And get following exception on slow queries:
>>>> 
>>>> [catalina-exec-18] 04-02 10:27:11 ERROR TransactionInterceptor:414 -
>>>> Application exception overridden by rollback exception
>>>> java.lang.NullPointerException
>>>>              at
>>>> 
>>> org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:86)
>>>>              at
>>>> 
>>> org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:237)
>>>> 
>>>> I wasn't able to google for a solution/bugfix therefore I would like
>>>> to ask the Tomcat community for help on this issue. Is this a known
>>>> bug?
>>> 
>>> There are a couple NPE's reported here.  Could be what you are seeing…
>>> 
>>>   https://issues.apache.org/bugzilla/show_bug.cgi?id=51582
>>> 
>>> Probably would be best if you could upgrade to the latest release and see
>>> if the problem still continues.  If you can't upgrade Tomcat, at least
>>> upgrade the jdbc-pool jar.
>>> 
>>> Dan
>>> 
>>> 
>>>> 
>>>> When looking at the source code:
>>>> 
>>>> 85:  QueryStats qs = this.getQueryStats(sql);
>>>> 86:  qs.failure(delta, now);
>>>> 
>>>> It looks like getQueryStats(sql) returned null and indeed it does so
>>>> on at leas one ocassion:
>>>> 
>>>>    protected QueryStats getQueryStats(String sql) {
>>>>         if (sql==null) sql = "";
>>>>         ConcurrentHashMap<String,QueryStats> queries =
>>>> SlowQueryReport.this.queries;
>>>>>>      if (queries==null) return null;
>>>> 
>>>> However, non of the uses of getQueryStats() in SlowQueryReport guard
>>>> against this null. It seems to be a bug.
>>>> 
>>>> --
>>>> Regards,
>>>> Tomasz Kowalczewski
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>> 
>>> 
>> 
>> Thanks for your answer. Yes, the tomcat installation is a bit old. I have
>> checked SlowQueryReport in trunk:
>> 
>> 
>> http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?view=log
>> 
>> and there are only minor changes (generics and toString changes) and no
>> real fix for getQueryStats returning null. However, I will try upgrading
>> and will report back if it solves the issue.
>> 
>> --
>> Regards,
>> Tomasz Kowalczewski
>> 
> 
> 
> 
> -- 
> Tomasz Kowalczewski


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


Re: NPE in SlowQuery

Posted by Tomasz Kowalczewski <to...@gmail.com>.
Hi,

when first reporting this issue I was mistaken about the configuration.
Although we use an older tomcat version, the tomcat-jdbc is pulled into our
application as a separate dependency. I have upgraded it to newest version
(7.0.39) and still see similar exception happening:

[http-bio-8080-exec-208] 05-16 17:16:25 ERROR TransactionInterceptor:414 -
Application exception overridden by rollback exception
java.lang.NullPointerException

               at
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:89)

               at
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:237)

               at $Proxy238.executeQuery(Unknown Source)


On Tue, Apr 2, 2013 at 2:59 PM, Tomasz Kowalczewski <
tomasz.kowalczewski@gmail.com> wrote:

> On Tue, Apr 2, 2013 at 2:43 PM, Daniel Mikusa <dm...@vmware.com> wrote:
>
>> On Apr 2, 2013, at 8:15 AM, Tomasz Kowalczewski wrote:
>>
>> > Hello all,
>> >
>> > we are running Tomcat 7 on Amazon EC2:
>> >
>> > Server version: Apache Tomcat/7.0.22
>> > Server built:   Sep 27 2011 09:40:50
>> > Server number:  7.0.22.0
>>
>> As you can see from the date, this version is getting to be pretty old.
>>  You should consider upgrading.
>>
>> > OS Name:        Linux
>> > OS Version:     2.6.34.7-56.40.amzn1.i686
>> > Architecture:   i386
>> > JVM Version:    1.7.0_03-b04
>> >
>> > And get following exception on slow queries:
>> >
>> > [catalina-exec-18] 04-02 10:27:11 ERROR TransactionInterceptor:414 -
>> > Application exception overridden by rollback exception
>> > java.lang.NullPointerException
>> >               at
>> >
>> org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:86)
>> >               at
>> >
>> org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:237)
>> >
>> > I wasn't able to google for a solution/bugfix therefore I would like
>> > to ask the Tomcat community for help on this issue. Is this a known
>> > bug?
>>
>> There are a couple NPE's reported here.  Could be what you are seeing…
>>
>>    https://issues.apache.org/bugzilla/show_bug.cgi?id=51582
>>
>> Probably would be best if you could upgrade to the latest release and see
>> if the problem still continues.  If you can't upgrade Tomcat, at least
>> upgrade the jdbc-pool jar.
>>
>> Dan
>>
>>
>> >
>> > When looking at the source code:
>> >
>> > 85:  QueryStats qs = this.getQueryStats(sql);
>> > 86:  qs.failure(delta, now);
>> >
>> > It looks like getQueryStats(sql) returned null and indeed it does so
>> > on at leas one ocassion:
>> >
>> >     protected QueryStats getQueryStats(String sql) {
>> >          if (sql==null) sql = "";
>> >          ConcurrentHashMap<String,QueryStats> queries =
>> > SlowQueryReport.this.queries;
>> >>>       if (queries==null) return null;
>> >
>> > However, non of the uses of getQueryStats() in SlowQueryReport guard
>> > against this null. It seems to be a bug.
>> >
>> > --
>> > Regards,
>> > Tomasz Kowalczewski
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> > For additional commands, e-mail: users-help@tomcat.apache.org
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> Thanks for your answer. Yes, the tomcat installation is a bit old. I have
> checked SlowQueryReport in trunk:
>
>
> http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?view=log
>
> and there are only minor changes (generics and toString changes) and no
> real fix for getQueryStats returning null. However, I will try upgrading
> and will report back if it solves the issue.
>
> --
> Regards,
> Tomasz Kowalczewski
>



-- 
Tomasz Kowalczewski

Re: NPE in SlowQuery

Posted by Tomasz Kowalczewski <to...@gmail.com>.
On Tue, Apr 2, 2013 at 2:43 PM, Daniel Mikusa <dm...@vmware.com> wrote:

> On Apr 2, 2013, at 8:15 AM, Tomasz Kowalczewski wrote:
>
> > Hello all,
> >
> > we are running Tomcat 7 on Amazon EC2:
> >
> > Server version: Apache Tomcat/7.0.22
> > Server built:   Sep 27 2011 09:40:50
> > Server number:  7.0.22.0
>
> As you can see from the date, this version is getting to be pretty old.
>  You should consider upgrading.
>
> > OS Name:        Linux
> > OS Version:     2.6.34.7-56.40.amzn1.i686
> > Architecture:   i386
> > JVM Version:    1.7.0_03-b04
> >
> > And get following exception on slow queries:
> >
> > [catalina-exec-18] 04-02 10:27:11 ERROR TransactionInterceptor:414 -
> > Application exception overridden by rollback exception
> > java.lang.NullPointerException
> >               at
> >
> org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:86)
> >               at
> >
> org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:237)
> >
> > I wasn't able to google for a solution/bugfix therefore I would like
> > to ask the Tomcat community for help on this issue. Is this a known
> > bug?
>
> There are a couple NPE's reported here.  Could be what you are seeing…
>
>    https://issues.apache.org/bugzilla/show_bug.cgi?id=51582
>
> Probably would be best if you could upgrade to the latest release and see
> if the problem still continues.  If you can't upgrade Tomcat, at least
> upgrade the jdbc-pool jar.
>
> Dan
>
>
> >
> > When looking at the source code:
> >
> > 85:  QueryStats qs = this.getQueryStats(sql);
> > 86:  qs.failure(delta, now);
> >
> > It looks like getQueryStats(sql) returned null and indeed it does so
> > on at leas one ocassion:
> >
> >     protected QueryStats getQueryStats(String sql) {
> >          if (sql==null) sql = "";
> >          ConcurrentHashMap<String,QueryStats> queries =
> > SlowQueryReport.this.queries;
> >>>       if (queries==null) return null;
> >
> > However, non of the uses of getQueryStats() in SlowQueryReport guard
> > against this null. It seems to be a bug.
> >
> > --
> > Regards,
> > Tomasz Kowalczewski
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Thanks for your answer. Yes, the tomcat installation is a bit old. I have
checked SlowQueryReport in trunk:

http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?view=log

and there are only minor changes (generics and toString changes) and no
real fix for getQueryStats returning null. However, I will try upgrading
and will report back if it solves the issue.

-- 
Regards,
Tomasz Kowalczewski

Re: NPE in SlowQuery

Posted by Daniel Mikusa <dm...@vmware.com>.
On Apr 2, 2013, at 8:15 AM, Tomasz Kowalczewski wrote:

> Hello all,
> 
> we are running Tomcat 7 on Amazon EC2:
> 
> Server version: Apache Tomcat/7.0.22
> Server built:   Sep 27 2011 09:40:50
> Server number:  7.0.22.0

As you can see from the date, this version is getting to be pretty old.  You should consider upgrading.

> OS Name:        Linux
> OS Version:     2.6.34.7-56.40.amzn1.i686
> Architecture:   i386
> JVM Version:    1.7.0_03-b04
> 
> And get following exception on slow queries:
> 
> [catalina-exec-18] 04-02 10:27:11 ERROR TransactionInterceptor:414 -
> Application exception overridden by rollback exception
> java.lang.NullPointerException
>               at
> org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.reportFailedQuery(SlowQueryReport.java:86)
>               at
> org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport$StatementProxy.invoke(AbstractQueryReport.java:237)
> 
> I wasn't able to google for a solution/bugfix therefore I would like
> to ask the Tomcat community for help on this issue. Is this a known
> bug?

There are a couple NPE's reported here.  Could be what you are seeing…

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

Probably would be best if you could upgrade to the latest release and see if the problem still continues.  If you can't upgrade Tomcat, at least upgrade the jdbc-pool jar.

Dan


> 
> When looking at the source code:
> 
> 85:  QueryStats qs = this.getQueryStats(sql);
> 86:  qs.failure(delta, now);
> 
> It looks like getQueryStats(sql) returned null and indeed it does so
> on at leas one ocassion:
> 
>     protected QueryStats getQueryStats(String sql) {
>          if (sql==null) sql = "";
>          ConcurrentHashMap<String,QueryStats> queries =
> SlowQueryReport.this.queries;
>>>       if (queries==null) return null;
> 
> However, non of the uses of getQueryStats() in SlowQueryReport guard
> against this null. It seems to be a bug.
> 
> --
> Regards,
> Tomasz Kowalczewski
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

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