Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r84hT-0085si-6V for pgsql-jdbc@arkaria.postgresql.org; Tue, 28 Nov 2023 20:28:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r84hR-007RZp-TM for pgsql-jdbc@arkaria.postgresql.org; Tue, 28 Nov 2023 20:28:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r84hR-007RZg-Kq for pgsql-jdbc@lists.postgresql.org; Tue, 28 Nov 2023 20:28:53 +0000 Received: from pgintl.fastcrypt.com ([149.56.129.164]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r84hN-00938Z-Vs for pgsql-jdbc@lists.postgresql.org; Tue, 28 Nov 2023 20:28:53 +0000 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by pgintl.fastcrypt.com (Postfix) with ESMTPSA id 964A220188 for ; Tue, 28 Nov 2023 15:28:47 -0500 (EST) Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-54b0c7987easo5538001a12.3 for ; Tue, 28 Nov 2023 12:28:47 -0800 (PST) X-Gm-Message-State: AOJu0Ywef0foea2lwTojK5uqFpKWPzQxEmo/eZX7DBPQP9Hb9Aoa2gei rAJIgAb/bgmjhhYqu747GW64hCdatTIOuI47X4I= X-Google-Smtp-Source: AGHT+IGaXYiecubkljM3+Z812+pomq4vPi6W1PoLrimJqafnRtIyyLdhdbJqiG827NKwkHuTD1QjSDOg7LUF0zcuF+U= X-Received: by 2002:a50:9fe9:0:b0:54a:97c4:b035 with SMTP id c96-20020a509fe9000000b0054a97c4b035mr13492413edf.1.1701203326333; Tue, 28 Nov 2023 12:28:46 -0800 (PST) MIME-Version: 1.0 References: <2c2e0f5d-4fe2-472f-a213-5cf58ec993c5.ref@yahoo.com> <2c2e0f5d-4fe2-472f-a213-5cf58ec993c5@yahoo.com> In-Reply-To: From: Dave Cramer Date: Tue, 28 Nov 2023 15:28:27 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Driver hangs in connect->MakeSSL.convert->SSLSocketImpl.startHandshake To: Martin Lichtin Cc: pgsql-jdbc@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000f4fa25060b3c438a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000f4fa25060b3c438a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 28 Nov 2023 at 09:07, Dave Cramer wrote= : > Hi Martin, > > Thanks for the report. I'll have a look. > Dave Cramer > > > On Tue, 28 Nov 2023 at 08:27, Martin Lichtin wrote: > >> Hi >> >> I'm seeing this thread hanging in the "getConnection" method, with no >> timeout in sight. >> However, the PGXADataSource is configured with a "connectTimeout" of 10 >> seconds. >> >> 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 >> sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:464= ) >> at >> sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:1= 65) >> at sun.security.ssl.SSLTransport.decode(SSLTransport.java:109) >> at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1392) >> at >> sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:13= 00) >> at >> sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:435) >> at org.postgresql.ssl.MakeSSL.convert(MakeSSL.java:41) >> at >> org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactory= Impl.java:571) >> at >> org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactor= yImpl.java:168) >> at >> org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(Connecti= onFactoryImpl.java:235) >> at >> org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.j= ava:49) >> at org.postgresql.jdbc.PgConnection.(PgConnection.java:223) >> at org.postgresql.Driver.makeConnection(Driver.java:402) >> at org.postgresql.Driver.connect(Driver.java:261) >> at java.sql.DriverManager.getConnection(DriverManager.java:664) >> at java.sql.DriverManager.getConnection(DriverManager.java:247) >> at >> org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.jav= a:103) >> at >> org.postgresql.xa.PGXADataSource.getXAConnection(PGXADataSource.java:49) >> at >> org.postgresql.xa.PGXADataSource.getXAConnection(PGXADataSource.java:35) >> >> Any reason this timeout is not being applied here? >> >> The version in use here is 42.3.6 >> > This Make sure to pass any network timeouts to the new SSL connection. by davecramer =C2=B7 Pull Request #3040 =C2=B7 pgjdbc/pgjdbc (github.com) should fix the problem, can you check ? Dave --000000000000f4fa25060b3c438a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Tue, 28 N= ov 2023 at 09:07, Dave Cramer <davecramer@postgres.rocks> wrote:
<= /div>
Hi= =C2=A0Martin,

Thanks for the report. I'll have a loo= k.=C2=A0
<= div dir=3D"ltr">Dave Cramer

On Tue, 2= 8 Nov 2023 at 08:27, Martin Lichtin <lichtin@yahoo.com> wrote:
=20 =20 =20

Hi

I'm seeing this thread hanging in the "getConnection" method, with no timeout in sight.
However, the PGXADataSource is configured with a "connectTimeout" of 10 seconds. =

=C2=A0=C2=A0 java.lang.Thread.State: RUNNABLE=
=C2=A0=C2=A0 =C2=A0at java.net.SocketInputStream.socketRead0(Native= Method)
=C2=A0=C2=A0 =C2=A0at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) =C2=A0=C2=A0 =C2=A0at java.net.SocketInputStream.read(SocketInputStream.java:171)
=C2=A0=C2=A0 =C2=A0at java.net.SocketInputStream.read(SocketInputStream.java:141)
=C2=A0=C2=A0 =C2=A0at sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:464) =C2=A0=C2=A0 =C2=A0at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:165)=
=C2=A0=C2=A0 =C2=A0at sun.security.ssl.SSLTransport.decode(SSLTransport.java:109)
=C2=A0=C2=A0 =C2=A0at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1392)
=C2=A0=C2=A0 =C2=A0at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1300)=
=C2=A0=C2=A0 =C2=A0at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:43= 5)
=C2=A0=C2=A0 =C2=A0at org.postgresql.ssl.MakeSSL.convert(MakeSSL.ja= va:41)
=C2=A0=C2=A0 =C2=A0at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImp= l.java:571)
=C2=A0=C2=A0 =C2=A0at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryIm= pl.java:168)
=C2=A0=C2=A0 =C2=A0at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionF= actoryImpl.java:235)
=C2=A0=C2=A0 =C2=A0at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java= :49)
=C2=A0=C2=A0 =C2=A0at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:223= )
=C2=A0=C2=A0 =C2=A0at org.postgresql.Driver.makeConnection(Driver.j= ava:402)
=C2=A0=C2=A0 =C2=A0at org.postgresql.Driver.connect(Driver.java:261= )
=C2=A0=C2=A0 =C2=A0at java.sql.DriverManager.getConnection(DriverManager.java:664)
=C2=A0=C2=A0 =C2=A0at java.sql.DriverManager.getConnection(DriverManager.java:247)
=C2=A0=C2=A0 =C2=A0at org.postgresql.ds.common.BaseDataSource.getConnection(BaseDataSource.java:1= 03)
=C2=A0=C2=A0 =C2=A0at org.postgresql.xa.PGXADataSource.getXAConnection(PGXADataSource.jav= a:49)
=C2=A0=C2=A0 =C2=A0at org.postgresql.xa.PGXADataSource.getXAConnection(PGXADataSource.jav= a:35)

Any reason this timeout is not being applied here?

The version in use here is 42.3.6



<= /div>
Dave
--000000000000f4fa25060b3c438a--