Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbJHP-0000Zn-BK for pgsql-jdbc@arkaria.postgresql.org; Wed, 20 May 2020 07:36:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbJHO-0007iM-1V for pgsql-jdbc@arkaria.postgresql.org; Wed, 20 May 2020 07:36:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbIi2-0003Ue-9E for pgsql-jdbc@lists.postgresql.org; Wed, 20 May 2020 07:00:10 +0000 Received: from mail1.sandvine.com ([64.7.137.134]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jbIhu-0007io-FO for pgsql-jdbc@postgresql.org; Wed, 20 May 2020 07:00:09 +0000 Received: from WTL-EXCHSV2-1.sandvine.com (192.168.194.58) by WTL-EXCHSV2-1.sandvine.com (192.168.194.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521) id 15.1.1847.3; Wed, 20 May 2020 02:59:48 -0400 Received: from blr-exchsv1-1.sandvine.com (10.30.4.73) by WTL-EXCHSV2-1.sandvine.com (192.168.194.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521) id 15.1.1847.3 via Frontend Transport; Wed, 20 May 2020 02:59:47 -0400 Received: from blr-exchsv1-1.sandvine.com (10.30.4.73) by blr-exchsv1-1.sandvine.com (10.30.4.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P521) id 15.1.1847.3; Wed, 20 May 2020 12:29:47 +0530 Received: from blr-exchsv1-1.sandvine.com ([fe80::8cb6:e09c:f011:98f6]) by blr-exchsv1-1.sandvine.com ([fe80::8cb6:e09c:f011:98f6%23]) with mapi id 15.01.1847.003; Wed, 20 May 2020 12:29:47 +0530 From: Karthik Shivashankar To: "pgsql-jdbc@postgresql.org" CC: Doug Fickling , Padam Sonar , Raghavendra Chikmagalur Eswarappa Subject: CopyManager.copyOut stuck in socket read Thread-Topic: CopyManager.copyOut stuck in socket read Thread-Index: AdYudEpaLxvZX5xMQ4u1n/D7l4uPsQ== Date: Wed, 20 May 2020 06:59:47 +0000 Message-ID: <9e27f4f07fed4670a2dbbbe77a0f4e0f@sandvine.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [171.61.73.194] x-c2processedorg: b2f06e69-072f-40ee-90c5-80a34e700794 Content-Type: multipart/alternative; boundary="_000_9e27f4f07fed4670a2dbbbe77a0f4e0fsandvinecom_" MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_9e27f4f07fed4670a2dbbbe77a0f4e0fsandvinecom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Team, We are using a java application that does something like "COPY (select xyz = from abc ) TO filename.csv.gz" using JDBC to postgres 9.3.11 server. Java version: openjdk version "1.8.0_151" Postgres server: PostgreSQL 9.3.11 on x86_64-unknown-linux-gnu, compiled by= gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), 64-bit JDBC driver: postgresql-8.4-701.jdbc3.jar * The problem is that the COPY is just running there forever even tho= ugh the table it is referring to has <10 columns with ~50 rows. * Thread dump indicates copyOut is stuck in socket read. There is no = enforcement of a timeout in application nor we have added a statement_timeo= ut. * We want to understand why it is stuck as it has been running for mo= re than 3 days now. Inspecting the target csv.gz file, it has no content i= n it yet. * The CPU utilization of the pid representing the query ( captured fr= om pg_stat_activity ) shows close to 100%. Is this some known issue? * I know we are in old version but would like to know if this is a bu= g that's already seen? Looking at release notes, I'm not able to find out. "OurThread" #21 prio=3D5 os_prio=3D0 tid=3D0x00007f37fc3ed570 nid=3D0x23ca7= runnable [0x00007f37e5d79000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116= ) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleB= ufferedInputStream.java:135) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(Visib= leBufferedInputStream.java:104) at org.postgresql.core.VisibleBufferedInputStream.read(VisibleBuffe= redInputStream.java:73) at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259) at org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(Quer= yExecutorImpl.java:893) at org.postgresql.core.v3.QueryExecutorImpl.startCopy(QueryExecutor= Impl.java:713) - locked <0x00000000fb497b68> (a org.postgresql.core.v3.QueryExecut= orImpl) at org.postgresql.copy.CopyManager.copyOut(CopyManager.java:63) at org.postgresql.copy.CopyManager.copyOut(CopyManager.java:103) at etl.task.extract.SelectFromDatabaseTableTask.execute(SelectFrom= DatabaseTableTask.java:118) at etl.jobprocessor.JobApplication.mainline(JobApplication.java:25= 0) at etl.application.Application.run(Application.java:258) at java.lang.Thread.run(Thread.java:748) Thanks, Karthik S Disclaimer: This communication (including any attachments) is intended for the use of t= he intended recipient(s) only and may contain information that is considere= d confidential, proprietary, sensitive and/or otherwise legally protected. = Any unauthorized use or dissemination of this communication is strictly pro= hibited. If you have received this communication in error, please immediate= ly notify the sender by return e-mail message and delete all copies of the = original communication. Thank you for your cooperation. --_000_9e27f4f07fed4670a2dbbbe77a0f4e0fsandvinecom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Team,

 

We are using a java application that does something = like “COPY (select xyz from abc ) TO filename.csv.gz” using JDB= C to postgres 9.3.11 server.

 

Java version: openjdk version "1.8.0_151= "

Postgres server: PostgreSQL 9.3.11 on x86_64-= unknown-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), = 64-bit

JDBC driver: postgresql-8.4-701.jdbc3.jar

 

·       The problem is that the COPY is just running= there forever even though the table it is referring to has <10 columns = with ~50 rows.

·       Thread dump indicates copyOut is stuck in so= cket read. There is no enforcement of a timeout in application nor we have = added a statement_timeout.

·       We want to understand why it is stuck as it = has been running for more than 3 days now.  Inspecting the target csv.= gz file, it has no content in it yet.

·       The CPU utilization of the pid representing = the query ( captured from pg_stat_activity ) shows close to 100%.  Is = this some known issue?

·       I know we are in old version but would like = to know if this is a bug that’s already seen? Looking at release note= s, I’m not able to find out.

 

"OurThread" #21 prio=3D5 os_prio=3D0= tid=3D0x00007f37fc3ed570 nid=3D0x23ca7 runnable [0x00007f37e5d79000]<= /o:p>

   java.lang.Thread.State: RUNNABLE<= o:p>

        = at java.net.SocketInputStream.socketRead0(Native Method)<= /b>

        = at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)

        at = java.net.SocketInputStream.read(SocketInputStream.java:171)

        at = java.net.SocketInputStream.read(SocketInputStream.java:141)

        at = org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInpu= tStream.java:135)

        at = org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedI= nputStream.java:104)

        at = org.postgresql.core.VisibleBufferedInputStream.read(VisibleBufferedInputStr= eam.java:73)

        at = org.postgresql.core.PGStream.ReceiveChar(PGStream.java:259)

        at = org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(QueryExecutorIm= pl.java:893)

        = at org.postgresql.core.v3.QueryExecutorImpl.startCopy(QueryExecutorImpl.jav= a:713)

        = - locked <0x00000000fb497b68> (a org.postgresql.core.v3.QueryExecutor= Impl)

        = at org.postgresql.copy.CopyManager.copyOut(CopyManager.java:63)<= /span>

        = at org.postgresql.copy.CopyManager.copyOut(CopyManager.java:103)=

        at =  etl.task.extract.SelectFromDatabaseTableTask.execute(SelectFromDataba= seTableTask.java:118)

        at =  etl.jobprocessor.JobApplication.mainline(JobApplication.java:250)

        at =  etl.application.Application.run(Application.java:258)

        at = java.lang.Thread.run(Thread.java:748)

 

Thanks,

Karthik S

Disclaimer:
This communication (including any attachments) is intended for the use of t= he intended recipient(s) only and may contain information that is considere= d confidential, proprietary, sensitive and/or otherwise legally protected. = Any unauthorized use or dissemination of this communication is strictly prohibited. If you have received this co= mmunication in error, please immediately notify the sender by return e-mail= message and delete all copies of the original communication. Thank you for= your cooperation.

--_000_9e27f4f07fed4670a2dbbbe77a0f4e0fsandvinecom_--