Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 18632 invoked from network); 19 Jul 2009 14:31:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 Jul 2009 14:31:32 -0000 Received: (qmail 27341 invoked by uid 500); 19 Jul 2009 14:32:37 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 27252 invoked by uid 500); 19 Jul 2009 14:32:37 -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 27242 invoked by uid 99); 19 Jul 2009 14:32:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Jul 2009 14:32:37 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 19 Jul 2009 14:32:35 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id CC867234C044 for ; Sun, 19 Jul 2009 07:32:14 -0700 (PDT) Message-ID: <1202342585.1248013934822.JavaMail.jira@brutus> Date: Sun, 19 Jul 2009 07:32:14 -0700 (PDT) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Updated: (DERBY-4312) SQLException XJ215 on insert with setCharacterStream() and autocommit off in mailjdbc test In-Reply-To: <389048114.1247835795059.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-4312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kathey Marsden updated DERBY-4312: ---------------------------------- Attachment: derby-4312_diff.txt Here is an updated patch for this issue that changes StreamingColumnTest to look for the XN017 error when the stream is reused after commit instead of XJ215. suites.All and derbyall ran fine. I will test with the mailjdbc network server test and then commit to trunk, 10.5 and 10.4 Monday or Tuesday if there are no comments. > SQLException XJ215 on insert with setCharacterStream() and autocommit off in mailjdbc test > ------------------------------------------------------------------------------------------- > > Key: DERBY-4312 > URL: https://issues.apache.org/jira/browse/DERBY-4312 > Project: Derby > Issue Type: Bug > Components: JDBC, Network Client > Affects Versions: 10.4.2.0, 10.5.1.1, 10.5.2.0, 10.6.0.0 > Environment: SuSE Linux IBM 1.6 SR4 > Reporter: Kathey Marsden > Assignee: Kathey Marsden > Attachments: create.sql, derby-4312_diff.txt, derby-4312_diff.txt, ReproDerby4312.java > > > I am running the 10.5 maildbc test on Linux with network server and the 10.5.2.0 release candidate and an updated derbyTesting.jar to have just Lily's change to change the backup user: I see in the test output early and often, this error inserting data into the table: > SQLState: XJ215 > Severity: 20000 > Message: You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() method or after > Clob's transaction has been committed or rolled back. > java.sql.SQLException: You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() m > ter the Blob/Clob's transaction has been committed or rolled back. > at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source) > at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source) > at org.apache.derby.client.am.Lob.checkValidity(Unknown Source) > at org.apache.derby.client.am.Clob.length(Unknown Source) > at org.apache.derby.client.net.NetStatementRequest.computeProtocolTypesAndLengths(Unknown Source) > at org.apache.derby.client.net.NetStatementRequest.buildSQLDTAcommandData(Unknown Source) > at org.apache.derby.client.net.NetStatementRequest.writeExecute(Unknown Source) > at org.apache.derby.client.net.NetPreparedStatement.writeExecute_(Unknown Source) > at org.apache.derby.client.am.PreparedStatement.writeExecute(Unknown Source) > at org.apache.derby.client.am.PreparedStatement.flowExecute(Unknown Source) > at org.apache.derby.client.am.PreparedStatement.executeUpdateX(Unknown Source) > at org.apache.derby.client.am.PreparedStatement.executeUpdate(Unknown Source) > at org.apache.derbyTesting.system.mailjdbc.utils.DbTasks.insertMail(DbTasks.java:447) > at org.apache.derbyTesting.system.mailjdbc.tasks.Refresh.insertMail(Refresh.java:99) > at org.apache.derbyTesting.system.mailjdbc.tasks.Refresh.doWork(Refresh.java:75) > at org.apache.derbyTesting.system.mailjdbc.tasks.Refresh.run(Refresh.java:51) > Caused by: org.apache.derby.client.am.SqlException: You cannot invoke other java.sql.Clob/java.sql.Blob metho > lling the free() method or after the Blob/Clob's transaction has been committed or rolled back. > The interesting thing is that the test itself is not using any Clob methods it uses setCharacterStream and also autocommit is off. > Below is a code excerpt and > conn.setAutoCommit(false); > PreparedStatement insertFirst = conn.prepareStatement( > Statements.insertStr, Statement.RETURN_GENERATED_KEYS); > String name = new String("ABCD"); > String l_name = new String("WXYZ"); > long s_insert = System.currentTimeMillis(); > for (int i = 0; i < num; i++) { > String new_name = new String(increment(name, 60)); > String new_lname = new String(decrement(l_name, 60)); > insertFirst.setString(1, new_name); > insertFirst.setString(2, new_lname); > insertFirst.setTimestamp(3, new Timestamp(System > .currentTimeMillis())); > name = new_name; > l_name = new_lname; > try { > // to create a stream of random length between 200 bytes and 3MB > int clobLength = Rn.nextInt(3078000 - 200 + 1) + 200; > streamReader = new LoopingAlphabetReader(clobLength, > CharAlphabet.modernLatinLowercase()); > insertFirst.setCharacterStream(4, streamReader, clobLength); > } catch (Exception e) { > MailJdbc.logAct.logMsg(LogFile.ERROR + thread_name + " : " > + "File not found Exception : " + e.getMessage()); > errorPrint(e); > throw e; > } > int rand_num = Rn.nextInt(10 - 1); > if (i == rand_num) { > ResultSet rs = stmt > .executeQuery("select count(*) from REFRESH.INBOX where attach_id>0"); > while (rs.next()) { > id_count = rs.getInt(1); > insertFirst.setInt(5, rs.getInt(1) + 1); > } > rs.close(); > conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); > } else > insertFirst.setInt(5, 0); > insertFirst > .setString( > 6, > "This column is used only to by pass the space problem. If the problem still exists, then we are going to " > + "have a serious issue here.*****************************************************************************************************"); > int result = insertFirst.executeUpdate(); > if I connect with ij I do see some rows in the INBOX, so some inserts do seem to be happening. > Kristian pointed out that this looks similar to DERBY-4224 with setAsciiStream() but this looks far more serious as autocommit is off and there does not appear to be a commit, so there is no obvious workaround. I assume this is also a regression. We shouldn't be throwing this error if the user did not use any Clob methods. I will try to narrow down the reproduction and track down where the issue was introduced. Knut said DERBY-4224 goes all the way back to 10.3.1.4 with DERBY-208. I don't know if it is the same case with this one. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.