Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8132118037 for ; Fri, 12 Jun 2015 15:10:49 +0000 (UTC) Received: (qmail 90221 invoked by uid 500); 12 Jun 2015 15:10:49 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 90191 invoked by uid 500); 12 Jun 2015 15:10:49 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 90179 invoked by uid 99); 12 Jun 2015 15:10:49 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2015 15:10:49 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 921721A5500 for ; Fri, 12 Jun 2015 15:10:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id buVpywdTECgy for ; Fri, 12 Jun 2015 15:10:44 +0000 (UTC) Received: from mail-qk0-f195.google.com (mail-qk0-f195.google.com [209.85.220.195]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id B3574429A8 for ; Fri, 12 Jun 2015 15:10:43 +0000 (UTC) Received: by qkby64 with SMTP id y64so4273684qkb.3 for ; Fri, 12 Jun 2015 08:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=bbKsoh7L2iceNIobAkH5MNVw260913+dnUAIhgfM4xA=; b=I1L/lTzAJm9XKnj48PgAg6coqaQsFG0WIgZ71kHqkfcXs56GigZJtlW+KAZuT1iVkG Xl48RMK04ci9F4ta8X0TpDoe+UC7dK8l0MzT2cE1nM3ztTQFYPEDcUwf9v9BnCZsFkRN R+kThYH50ZYT4pwVf3AAR5pVi7TBPmoBMTEnB4tGLu+Nxfz+slk62OeoN8RrsTcEkBAL 8GQch30V8VGAGWE0BtXdYj5WcdmkM4UCJyHAciIbFhFi2w8HgQqeLtoI/XRwKM3TXv4/ S44WOFPFttgqoFiOfj9W1FtdjCDeE1zzhObfeQ0LZXBHyPnK80P89ClyEgtLC4rBEWga 6g8w== X-Received: by 10.140.145.78 with SMTP id 75mr19906518qhr.61.1434121798318; Fri, 12 Jun 2015 08:09:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.18.161 with HTTP; Fri, 12 Jun 2015 08:09:37 -0700 (PDT) In-Reply-To: <272C0255-17C0-4353-B95C-941B84A9F43C@objectstyle.org> References: <1EF83356-E7BD-4438-88E2-30D222466E75@objectstyle.org> <272C0255-17C0-4353-B95C-941B84A9F43C@objectstyle.org> From: Mike Kienenberger Date: Fri, 12 Jun 2015 11:09:37 -0400 Message-ID: Subject: Re: java.sql.SQLException: Can't obtain connection. Request timed out. To: user@cayenne.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks for the pointer to jstack. Looking through the output now, but the problem doesn't persist. I've only had it happen twice in 3 or 4 days. I guess I need to dump a full all-thread stacktrace like jstack when the problem occurs to see what is going on. I'm also looking through the poolmanager source to see if there's any additional logging I could turn on, but I'm not seeing anything cayenne-related executing at the moment. And, interestingly enough, I only have 8 "PoolManagerCleanup" threads, and not the 9 that I expected. Maybe they are create-on-demand and one of my runtimes hasn't needed it yet? On Fri, Jun 12, 2015 at 10:56 AM, Andrus Adamchik wrote: > So there's a leak somewhere. Do you see any hanging threads with jstack, = or maybe some unclosed ResultIterators? > > Andrus > >> On Jun 12, 2015, at 5:51 PM, Mike Kienenberger wrot= e: >> >> ....And upping my connection pool size from 1 to 3 didn't help as I >> got the error again today, but this time with all 3 in use. >> >> Caused by: java.sql.SQLException: Can't obtain connection. Request >> timed out. Total used connections: 3 >> >> >> >> On Thu, Jun 11, 2015 at 11:41 AM, Mike Kienenberger = wrote: >>> So what I had when I originally deployed would have been three pools >>> of one connection each? That's fine. And that explains why it >>> worked without problems. >>> >>> So when I increased to 3 connections, I actually have 9 now, three in >>> each of the three pools which I definitely do not want. >>> >>> So apparently I only hit this problem in a single runtime's connection >>> pool, and not in all of them. That should make it easier to track >>> down what caused it. Thanks. >>> >>> >>> >>> On Thu, Jun 11, 2015 at 11:32 AM, Andrus Adamchik >>> wrote: >>>>> My guess is that all three runtimes share the same pool >>>> >>>> >>>> Actually no. If you have 3 runtimes, and let Cayenne instantiate its p= ool (as the stack trace implies) instead of using say container JNDI DataSo= urce, you should have 3 instances of the pool. You can try confirming the n= umber of PoolManager instances with VisualVM or jmap. >>>> >>>> Andrus >>>> >>>>> On Jun 11, 2015, at 6:18 PM, Mike Kienenberger w= rote: >>>>> >>>>> So I finally put my old Cayenne 1.x-upgraded to 3.x app into producti= on. >>>>> >>>>> A couple of hours later, I got this error [1]. Note that my app >>>>> synchronizes requests so only one thread should ever be running >>>>> Cayenne requests at a time. >>>>> >>>>> My app has run for years with only a single connection. My 3.x app >>>>> ran in development for a year before it was deployed to production. >>>>> >>>>> Is this a fluke? I did raise my connection pool to 3 the next day, >>>>> but I don't want to arbitrarily assign a higher number and think I've >>>>> magically solved the problem. >>>>> >>>>> Does having three active server runtimes affect this? Before, my >>>>> query qualifiers were all handled inside the main runtime, but now I >>>>> have three separate runtimes configured. My guess is that all three >>>>> runtimes share the same pool, so this is probably not the cause. An= d >>>>> since the problem happened a couple hours later and the three runtime= s >>>>> were being used well before that without an error, I'd say experience >>>>> bears this out. >>>>> >>>>> >>>>> [1] >>>>> >>>>> Caused by: java.sql.SQLException: Can't obtain connection. Request >>>>> timed out. Total used connections: 1 >>>>> at org.apache.cayenne.conn.PoolManager.uncheckPooledConnection(= PoolManager.java:452) >>>>> at org.apache.cayenne.conn.PoolManager.getConnection(PoolManage= r.java:382) >>>>> at org.apache.cayenne.conn.PoolManager.getConnection(PoolManage= r.java:371) >>>>> at org.apache.cayenne.access.DataNode$TransactionDataSource.get= Connection(DataNode.java:351) >>>>> at org.apache.cayenne.access.DataNode.performQueries(DataNode.j= ava:259) >>>>> >>>> >> >