Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 56843 invoked from network); 17 Oct 2005 06:33:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 17 Oct 2005 06:33:16 -0000 Received: (qmail 39192 invoked by uid 500); 17 Oct 2005 06:33:15 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 39171 invoked by uid 500); 17 Oct 2005 06:33:14 -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 39160 invoked by uid 99); 17 Oct 2005 06:33:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Oct 2005 23:33:14 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [207.172.4.62] (HELO smtp02.mrf.mail.rcn.net) (207.172.4.62) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 16 Oct 2005 23:33:15 -0700 Received: from 205-178-43-114.s368.tnt1.sfrn.ca.dialup.rcn.com (HELO Nipper.rcn.com) ([205.178.43.114]) by smtp02.mrf.mail.rcn.net with ESMTP; 17 Oct 2005 02:32:51 -0400 X-IronPort-AV: i="3.97,221,1125892800"; d="scan'208"; a="133524216:sNHT21098228" Message-Id: <6.2.3.4.2.20051016231519.039dd640@pop.rcn.com> X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.4 Date: Sun, 16 Oct 2005 23:32:45 -0700 To: "Derby Discussion" From: Jeffrey Lichtman Subject: RE: Error 38000 with a stack overflow on recordset.next()? In-Reply-To: <411004C89F48004A9B41C341A515E7BA01530B8C@mail.oit.docfinit y.com> References: <411004C89F48004A9B41C341A515E7BA01530B8C@mail.oit.docfinity.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N >I start out by running the following prepared statement a few thousand >times: > >INSERT into existingfiles (path, id) VALUES (?, ?) > >Where path is a windows file path and id is an integer. I clear out the >parameters with clearParameters() after each insert and set them to new >values. Then I close and null out the statement. > >After that I create another prepared statement that looks like this: > >INSERT INTO filesystemfiles (path) VALUES (?) > >And run it a few hundred to a few thousand times with a string argument >in the form of a Windows file path. After that I close it and move on >to this select statement: > >SELECT path from filesystemfiles where path not in (select path from >existingfiles) > >I've run this as both a Statement and a PreparedStatment. I then get >back the ResultSet. Things blow up when I try to run next() on it. The >only thing that I can think is that the query using a subselect and two >large tables may be hosing up the Derby code. Let me know if you need >anything else. The interesting thing about this is that the stack overflow is in UnionResultSet.openCore, yet what you describe here has nothing to do with unions. There's nothing in the language code that I know of that would introduce a UnionResultSet into any of these statements. I suspect the real problem is with one of the INSERT statements. Cloudscape allows the VALUES clause on an INSERT to have more than one row. When you do this it represents it internally as an insert of a multi-way union of rows with constants in them. If your code put together an INSERT/VALUES with 100,000 rows, Cloudscape would represent it as 100,000 nested UnionResultSets. This could easily cause a stack overflow of the type you're seeing. Now, what I've described here doesn't match what you've described for your code, but is it possible your code doesn't do exactly what you think it does? I suppose the potential stack overflow from a huge VALUES clause could be considered a bug, although I don't know how important it would be to fix it. The most obvious fix would be to introduce a ValuesResultSet that iterates over a set of constant rows and a corresponding ValuesNode, and to change the parser so it generates a ValuesNode instead of a set of UnionNodes. - Jeff Lichtman swazoo@rcn.com Check out Swazoo Koolak's Web Jukebox at http://swazoo.com/