Re: JDBC executeBatch() hangs without error - Mailing list pgsql-jdbc
From | Kevin Wooten |
---|---|
Subject | Re: JDBC executeBatch() hangs without error |
Date | |
Msg-id | CA7036E0-11A1-4438-9373-BD12736DA8EE@me.com Whole thread Raw |
In response to | Re: JDBC executeBatch() hangs without error ("Vinay S (vinas)" <vinas@cisco.com>) |
Responses |
Re: JDBC executeBatch() hangs without error
|
List | 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@cisco.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 JOn the other Win 7, it hasn’t been working since Day 1.Where do I look?- VinayFrom: Dave Cramer [mailto:davecramer@gmail.com]
Sent: Thursday, September 26, 2013 10:59 PM
To: Vinay S (vinas)
Cc: List
Subject: Re: [JDBC] JDBC executeBatch() hangs without errorSo 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@cisco.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.htmlGist of that debugging info is thatProgram hangs exactly at
int read = wrapped.read(buffer, endIndex, canFit);
in VisibleBufferedInputStream.javaexecuteBatch() works fine on Win2008, whereas hangs on Win7 (different instance of Win 7 too)Any help here would be great.Thanks.- VinayFrom: davecramer@gmail.com [mailto:davecramer@gmail.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 errorI can't really say where the issue is.Can you try using batches of less than 254 to see if that works ?
On Thu, Sep 26, 2013 at 9:17 AM, vinay_s <vinas@cisco.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'
----------------------------------------------------------
pgsql-jdbc by date: