Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 791A2F819 for ; Tue, 2 Apr 2013 13:00:27 +0000 (UTC) Received: (qmail 49829 invoked by uid 500); 2 Apr 2013 13:00:24 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 49614 invoked by uid 500); 2 Apr 2013 13:00:23 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 49597 invoked by uid 99); 2 Apr 2013 13:00:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Apr 2013 13:00:23 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tomasz.kowalczewski@gmail.com designates 209.85.220.176 as permitted sender) Received: from [209.85.220.176] (HELO mail-vc0-f176.google.com) (209.85.220.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Apr 2013 13:00:17 +0000 Received: by mail-vc0-f176.google.com with SMTP id ib11so361295vcb.7 for ; Tue, 02 Apr 2013 05:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=YWzdZLxqWuVsXaKnRfaNaFmlARfiTVIeMpqcuSB8Bho=; b=WzUTWKNk6smYqeApPJaEM4JhztVH9RwCbvmUHj3oh0JFr4WJ+kucMgVlhGqA1AFWdJ rETC/suUaGg2NtqD5yPvEQYTNMUGPDfSOlIQhM2i5axaBYrPnH0naBo9nIn9ZZ3GONUd Fm8gVDYWsX9bHE0Yo3v9UQ2c4kCVCt8jQ4+UsW8g5+udV1ZtGVr96BFnGsh6qA27DuI1 xMgS+KtTidD1mq6ih9vfYJnZW+flArUJjZijwlexp51FlNQecKwrR0pIMf+2F4PyzTfa GBgqEs3k5szaskhWxRLD72GYBFawieapOELG5GNWCKSV4C90mmXNM7DerVvO2dUt87kD d4Yg== MIME-Version: 1.0 X-Received: by 10.220.223.80 with SMTP id ij16mr12518416vcb.28.1364907596409; Tue, 02 Apr 2013 05:59:56 -0700 (PDT) Received: by 10.58.39.232 with HTTP; Tue, 2 Apr 2013 05:59:56 -0700 (PDT) In-Reply-To: <997BA89E-7738-486A-BE76-17A06139B9E6@vmware.com> References: <997BA89E-7738-486A-BE76-17A06139B9E6@vmware.com> Date: Tue, 2 Apr 2013 14:59:56 +0200 Message-ID: Subject: Re: NPE in SlowQuery From: Tomasz Kowalczewski To: Tomcat Users List Content-Type: multipart/alternative; boundary=14dae9cdcb876f71db04d96050b3 X-Virus-Checked: Checked by ClamAV on apache.org --14dae9cdcb876f71db04d96050b3 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Tue, Apr 2, 2013 at 2:43 PM, Daniel Mikusa 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$StatementProx= y.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=85 > > https://issues.apache.org/bugzilla/show_bug.cgi?id=3D51582 > > 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 =3D 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=3D=3Dnull) sql =3D ""; > > ConcurrentHashMap queries =3D > > SlowQueryReport.this.queries; > >>> if (queries=3D=3Dnull) 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/o= rg/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?view=3Dlog 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. --=20 Regards, Tomasz Kowalczewski --14dae9cdcb876f71db04d96050b3--