Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 89296 invoked from network); 27 Jul 2006 21:59:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 27 Jul 2006 21:59:40 -0000 Received: (qmail 44070 invoked by uid 500); 27 Jul 2006 21:59:39 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 44038 invoked by uid 500); 27 Jul 2006 21:59:39 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 44028 invoked by uid 99); 27 Jul 2006 21:59:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 14:59:38 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [209.237.227.198] (HELO brutus.apache.org) (209.237.227.198) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Jul 2006 14:59:38 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id C40F67141F0 for ; Thu, 27 Jul 2006 21:57:14 +0000 (GMT) Message-ID: <21323467.1154037434800.JavaMail.jira@brutus> Date: Thu, 27 Jul 2006 14:57:14 -0700 (PDT) From: "Kristian Waagan (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-1510) 'SQLBinary.readFromStream' can enter endless loop In-Reply-To: <23914767.1152869429888.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-1510?page=all ] Kristian Waagan updated DERBY-1510: ----------------------------------- Attachment: derby-1510-1a.diff 'derby-1510-1a.diff' makes sure derby does not enter an endless loop if InputStream.available() returns 0 and we have already filled the buffer. Before, it was possible to start looping with a read(byte[], pos, 0) call (my laptop used 100% CPU for nearly 29 hours because of this...). The fix is minimal. If anyone wants to rewrite more of the method, please do so. Please review/commit the patch. > 'SQLBinary.readFromStream' can enter endless loop > ------------------------------------------------- > > Key: DERBY-1510 > URL: http://issues.apache.org/jira/browse/DERBY-1510 > Project: Derby > Issue Type: Bug > Components: JDBC, SQL > Affects Versions: 10.2.0.0 > Reporter: Kristian Waagan > Assigned To: Kristian Waagan > Priority: Minor > Attachments: derby-1510-1a.diff > > > Under certain circumstances, the method 'SQLBinary.readFromStream' can enter an endless loop while reading the stream. The following must be true for the bug to occur: > * There must be more data in the stream than what can fit into the initial buffer (32 K). > * The method 'available' of the stream returns 0. > Since the default return value for 'InputStream.available' is 0, and the method reading the stream can be used for data types CHAR FOR BIT DATA, VARCHAR FOR BIT DATA and LONG VARCHAR FOR BIT DATA, the bug should be fixed. The maximum length is 32700 bytes. > The method will also be used by SQLBlob, but it may be better to introduce a new streaming method for it, since the current implementation has memory-problems for large data (materializes the whole stream). A separate issue should/will be created for this. > The symptom for this bug is a hang when calling one of the execute methods of Prepared- or CallableStatement and maybe also certain set methods in ResultSet. > The visibility of this bug is very low, but the impact is severe/critical. When the JDBC 4 length less streaming overloads are added (DERBY-1417), visibility might increase. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira