Re: An I/O error occured while sending to the backend

From: gzh <gzhcoder(at)126(dot)com>
To: "Laurenz Albe" <laurenz(dot)albe(at)cybertec(dot)at>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: An I/O error occured while sending to the backend
Date: 2022-11-16 07:37:48
Message-ID: 18cffc90.499d.1847f5f6458.Coremail.gzhcoder@126.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you very much for your advice.

What I don't understand is that there is no problem when executing ① alone or ② alone,
the error occurs when ① and ② are executed together .
It works well when i let the application sleep after ① for 10 seconds before executing ② .
Is ② affected by ① ? Could you tell me why?

At 2022-11-16 14:57:41, "Laurenz Albe" <laurenz(dot)albe(at)cybertec(dot)at> wrote:
>On Wed, 2022-11-16 at 13:04 +0800, gzh wrote:
>> I have developed an application using the jdbc driver and
>> connecting to a postgresql database .
>> The application mainly does the following two things:
>> ① read data from the CSV file and insert it into the database
>> ② perform a database query
>> In my application, the above ① and ② are executed asynchronously.
>> Everything was working fine until I increase the amount of CSV data to more than 1000.
>> Randomly they receive an error, the stack trace of which is below.
>>
>> Caused by: java.net.SocketTimeoutException: Read timed out
>> at java.base/java.net.SocketInputStream.socketRead0(Native Method)
>> at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
>> at java.base/java.net.SocketInputStream.read(SocketInputStream.java:168)
>> at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
>> at java.base/sun.security.ssl.SSLSocketInputRecord.read(SSLSocketInputRecord.java:478)
>> at java.base/sun.security.ssl.SSLSocketInputRecord.readHeader(SSLSocketInputRecord.java:472)
>> at java.base/sun.security.ssl.SSLSocketInputRecord.bytesInCompletePacket(SSLSocketInputRecord.java:70)
>> at java.base/sun.security.ssl.SSLSocketImpl.readApplicationRecord(SSLSocketImpl.java:1454)
>> at java.base/sun.security.ssl.SSLSocketImpl$AppInputStream.read(SSLSocketImpl.java:1065)
>> at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:161)
>
>Well, set a longer socket timeout if you need to run long SQL statements, or tune
>those statements to be faster.
>
>https://jdbc.postgresql.org/documentation/use/#connection-parameters has more
>information about "socketTimeout".
>
>Yours,
>Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message shashidhar Reddy 2022-11-16 08:23:09 unrecognized node type: 350
Previous Message Laurenz Albe 2022-11-16 06:57:41 Re: An I/O error occured while sending to the backend