From: | "jingzhi(dot)zhang(at)outlook(dot)com" <jingzhi(dot)zhang(at)outlook(dot)com> |
---|---|
To: | Dave Cramer <pg(at)fastcrypt(dot)com> |
Cc: | List <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: PrepareStatement.execute() blocked because of long time 'create index' operation, connection leak |
Date: | 2016-06-07 11:36:04 |
Message-ID: | BLU436-SMTP10CA25E9CF37A72471EF6EF95D0@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hi Dave,
Thanks:)
But I need to clarify the question:
Because of the ‘create index’ sql statement execution (via jdbc) last nearly 30 minutes, the execute() method blocked forever.
At pg server side, about 30 minutes later, 'create index’ successfully finished. Then the connection state change to ‘idle’.
From jdbc client side, it seems ‘create index’ have not finished, but actually the operation already finished at server side.
This cause the client thread blocked and connection leak.
> 在 2016年6月7日,19:21,Dave Cramer <pg(at)fastcrypt(dot)com> 写道:
>
> There is a cancel statement, but I presume you want the create index to succeed. You may have to execute the execute() in a background thread to not block the main thread
>
> Dave Cramer
>
> davec(at)postgresintl(dot)com <mailto:davec(at)postgresintl(dot)com>
> www.postgresintl.com <http://www.postgresintl.com/>
> On 6 June 2016 at 12:25, jingzhi(dot)zhang(at)outlook(dot)com <mailto:jingzhi(dot)zhang(at)outlook(dot)com> <jingzhi(dot)zhang(at)outlook(dot)com <mailto:jingzhi(dot)zhang(at)outlook(dot)com>> wrote:
> Hi,
>
>
> I use jdbc to create index on a table, the sql of 'create index' cost about 30 minutes.
> Finally I found, the jdbc client thread blocked at PrepareStatement.execute(), not finished.
> At server side, query pg_stat_activity, the connection state already be ‘idle’ (index creation finished).
>
> Is there any suggestion? How to deal with the client thread blocking (read for a response message?) and connection leak.
>
>
> Thanks a lot.
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Vladimir Sitnikov | 2016-06-07 11:37:42 | Re: PrepareStatement.execute() blocked because of long time 'create index' operation, connection leak |
Previous Message | Dave Cramer | 2016-06-07 11:21:10 | Re: PrepareStatement.execute() blocked because of long time 'create index' operation, connection leak |