Return-Path: X-Original-To: apmail-db-derby-user-archive@www.apache.org Delivered-To: apmail-db-derby-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 E648ED67C for ; Sun, 4 Nov 2012 09:35:21 +0000 (UTC) Received: (qmail 3506 invoked by uid 500); 4 Nov 2012 09:35:20 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 3081 invoked by uid 500); 4 Nov 2012 09:35:20 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 3025 invoked by uid 99); 4 Nov 2012 09:35:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Nov 2012 09:35:17 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of john.foreign@gmail.com designates 74.125.83.44 as permitted sender) Received: from [74.125.83.44] (HELO mail-ee0-f44.google.com) (74.125.83.44) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Nov 2012 09:35:07 +0000 Received: by mail-ee0-f44.google.com with SMTP id d4so2823178eek.31 for ; Sun, 04 Nov 2012 01:34:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=gZlFReHntPo3pEbUJm2CjwVW5Ze/VC0pvd8RmDnHnpU=; b=fI1zXeh7MBqtzMeF1fSBav6fs+YzePyjKz9s5ORn2aG+qq+IbUsQ4cvXFFp37PehxV W+rk2vt7i6IqYfqe+u/VmWqSwNvF82/mkTf0NQjWGPKl4wshus8jkiTYWrtmTJ+OpCE9 kTztPuZpfBrmcAnTeTomeYyt4oQi28grjky9CwTEUreEXa7OeNqm8ykD2lAaNzHkaDoD dZgr5maNJzR7iglHruYijdTY6H3UAMQwxVdvfRpEVO2wjEXxo3M4bXJwoYLXEa7P6aap QCxzEWJSoLyTafhHePvZR/ciiU4wGHSGTSrxTIjo7+5Wye3t09i6/jGeZ5PyucZZS1PF rUWQ== Received: by 10.14.0.68 with SMTP id 44mr25235470eea.1.1352021687864; Sun, 04 Nov 2012 01:34:47 -0800 (PST) Received: from [192.168.1.101] (bzq-84-108-22-132.cablep.bezeqint.net. [84.108.22.132]) by mx.google.com with ESMTPS id o49sm38417619eep.5.2012.11.04.01.34.46 (version=SSLv3 cipher=OTHER); Sun, 04 Nov 2012 01:34:47 -0800 (PST) Message-ID: <509636AA.5020803@gmail.com> Date: Sun, 04 Nov 2012 11:34:34 +0200 From: John English User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2 MIME-Version: 1.0 To: Derby Discussion Subject: Re: 40XD0: "Container has been closed"? References: <5094FCBD.9020301@gmail.com> <50956B20.7040703@sbcglobal.net> In-Reply-To: <50956B20.7040703@sbcglobal.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On 03/11/2012 21:06, Katherine Marsden wrote: > This has the feel of two threads using the same Connection and one > commits or rolls back without coordination with the other. Typically > each thread should have it's own connection. Do you have a separate > connection for each thread and if so, what is the isolation level? No, each thread has its own connection. The situation is that tests can be run synchronously from a servlet, so a request comes in, a DB connection is created, the connection is used to do "select * from tests where id=?", and the results go back immediately in the response and the DB connection is then closed. Alternatively, tests can be scheduled to run asynchronously, and there is a thread created at system startup with its own connection which loops waiting for notifications that a test has completed and then issues exactly the same query. In the synchronous case it always works; in the asynchronous case it always fails. I've tried creating a new connection each time round the loop in the asynchronous case, but it makes no difference. Also if it were a thread contention issue I'd expect to see some timing-dependent behaviour, not total consistency. The rest of the row can always be read (ints and varchars and suchlike), but the clob always fails. I've tried reading the clob first; same thing. The isolation level is default, but in any case it happens even when nothing else is going on; I start an asynchronous test on my development rig with no other users, and then sit back and wait. It consistently hits the breakpoint I've set on the exception handler. This also points to it not being a thread contention problem. One final thing: my "fix" (where I read the rest of the row in one query and the clob in another) uses the same connection for both queries. So I'm totally baffled. Happy to have found a workaround but very annoyed that I don't understand why it works. Thanks for your help, -- John English