Re: JDBC executeBatch() hangs without error

From: Kevin Wooten <kdubb(at)me(dot)com>
To: "Vinay S (vinas)" <vinas(at)cisco(dot)com>
Cc: Dave Cramer <davecramer(at)gmail(dot)com>, List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC executeBatch() hangs without error
Date: 2013-09-26 17:40:49
Message-ID: CA7036E0-11A1-4438-9373-BD12736DA8EE@me.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Could this be related to the note in QueryExecutorImpl.java ~ line 287 titled "Deadlock Avoidance"?

If I remember correctly it's specifically related to batched queries and synchronous TCP.

On Sep 26, 2013, at 10:32 AM, "Vinay S (vinas)" <vinas(at)cisco(dot)com> wrote:

> Let me also add that there is inconsistency there too. For eg., this same program has been working on Win 7 on 1 system until yesterday, it just decided it wouldn’t J
>
> On the other Win 7, it hasn’t been working since Day 1.
>
> Where do I look?
>
> - Vinay
>
> From: Dave Cramer [mailto:davecramer(at)gmail(dot)com]
> Sent: Thursday, September 26, 2013 10:59 PM
> To: Vinay S (vinas)
> Cc: List
> Subject: Re: [JDBC] JDBC executeBatch() hangs without error
>
> So this is only win7 ??? sounds pretty strange as this is through tcp, and a java vm. Must be something in the O/S blocking it.
>
> Dave Cramer
>
>
> On Thu, Sep 26, 2013 at 1:04 PM, Vinay S (vinas) <vinas(at)cisco(dot)com> wrote:
> Hi Dave,
> Thanks for the reply.
>
> I did try debugging a bit more and have more info to share. Short answer, executeBatch() simply hangs for even 1 row.
>
> I updated my post to reflect the debugging info here http://postgresql.1045698.n5.nabble.com/JDBC-executeBatch-hangs-without-error-td5772465.html
>
> Gist of that debugging info is that
>
> Program hangs exactly at
> int read = wrapped.read(buffer, endIndex, canFit);
>
> in VisibleBufferedInputStream.java
>
>
> executeBatch() works fine on Win2008, whereas hangs on Win7 (different instance of Win 7 too)
>
> Any help here would be great.
>
> Thanks.
>
> - Vinay
>
> From: davecramer(at)gmail(dot)com [mailto:davecramer(at)gmail(dot)com] On Behalf Of Dave Cramer
> Sent: Thursday, September 26, 2013 9:55 PM
> To: Vinay S (vinas)
> Cc: List
> Subject: Re: [JDBC] JDBC executeBatch() hangs without error
>
> I can't really say where the issue is.
>
> Can you try using batches of less than 254 to see if that works ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
> On Thu, Sep 26, 2013 at 9:17 AM, vinay_s <vinas(at)cisco(dot)com> wrote:
> Postgres Version Used : 9.1.9 - 64 bit
> JDBC Driver used : PostgreSQL 9.2 JDBC4 (build 1003)
> JDK used : 1.6u45 - 64 bit
> OS: Windows 7 - 64 bit
>
> I have simple insert query using which I'm trying to import around 20,000
> rows by splitting them into 10 batches of 2000 each
>
> insert into Datapool (datapool_id,fk_template_column,fk_branch,value)
> values(?,?,?,?)
>
> is the JDBC prepared statement.
>
> Every 2000 rows, I add as a batch using
>
> stmt.addBatch();
>
> and and then call
>
> stmt.executeBatch();
>
> Program hangs at executeBatch() indefinitely and does not terminate.
>
> To debug further,
> - I took the source for the JDBC Driver
> - Enabled log_statement ='all' in postgresql.conf(restarted the service of
> course)
> - Appended ?loglevel=2 in the JDBC Connection URL
>
> I execute the program and saw that the executeBatch of 2000 entries just
> halts after 254 insert queries are bound.
>
>
> Output from the postgres log shows only one insert query
> ---------------------------------------------------------
> 2013-09-26 18:19:16 IST LOG: execute S_1: insert into Datapool
> (datapool_id,fk_template_column,fk_branch,value) values($1,$2,$3,$4)
> 2013-09-26 18:19:16 IST DETAIL: parameters: $1 = '32056', $2 = '2215', $3 =
> '21', $4 = 'col1'
> ----------------------------------------------------------

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2013-09-26 17:48:03 Re: JDBC executeBatch() hangs without error
Previous Message Vinay S (vinas) 2013-09-26 17:32:33 Re: JDBC executeBatch() hangs without error