Frontend unexpectedly terminates connection

Поиск
Список
Период
Сортировка
От Mikhail Pryakhin
Тема Frontend unexpectedly terminates connection
Дата
Msg-id CACgR--9QS8qu_DS7f=8qzYET65NLayrgeXVnf-AQoG3ov1KUCw@mail.gmail.com
обсуждение исходный текст
Список pgsql-general

Hello guys! I'm a little bit confused with the following case.

I've got a Postgressql server running on host A, and a java based client running on host B. The client uses org.postgresql.Driver JDBC driver (version 9.1-901.jdbc3).

sometimes while executing long running stored procedure I get exception "java.net.SocketException: Socket closed". I'm using org.apache.commons.dbcp.BasicDataSource for retrieving

connections. DBCP pool is configured with default options.

 

I got tcp dump in order to figure out on which side (client or server) socket is being closed;

 

Here is what I've got:

 

1.   Client B sends a test query message when tries to borrow connection from dbcp pool ("Select 1")

2.   Server A sends successful response back (Type: Command completion, Ready for query)

3.   Client B sends ACK message in response on server A response (see the item 2).

4.   Client B sends query message to the server A.

5.   Server A sends ACK message in response on client Query message (see the item 4).

6.   Client B sends terminating message (Type : Termination) after some time passed (from 3 to 10 or sometimes even more minutes).

7    Client B sends FIN ACK message to the server.

8.   Server A sends back ACK on termination message.

9.   Server A sends ACK on (FIN, ACK) message (item 7).

10.  Server A sends back a response on the client query (from item 4) Type: Row description Columns: 40.

11.  Client B sends RST message (reset).

12.  Server A continues sending response on the query Type: Data row Length: 438 Columns 40 and so on.

13   Client B sends RST message (reset) again.

14.  Server A continues sending response on the query Type: Data row Length: 438 Columns 40 and so on.

15.  Client B sends RST message (reset).

 

After that communication seems to be finished.

 

After the item 6, in my client logs I got Exception like the following:

 

Caused by: java.net.SocketException: Socket closed

        at java.net.SocketInputStream.socketRead0(Native Method)

        at java.net.SocketInputStream.read(SocketInputStream.java:152)

        at java.net.SocketInputStream.read(SocketInputStream.java:122)

        at org.postgresql.core.VisibleBufferedInputStream.readMore(VisibleBufferedInputStream.java:145)

        at org.postgresql.core.VisibleBufferedInputStream.ensureBytes(VisibleBufferedInputStream.java:114)

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

        at org.postgresql.core.PGStream.ReceiveChar(PGStream.java:274)

        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1661)

        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)

 

Could you please help me to figure out the reason of such a failure. (This bug happens once per 10 successful cases.)

 

Thanks in advance!

Best regards, Mike Pryakhin.

 

 




--
Regards, Mikhail Pryakhin.

В списке pgsql-general по дате отправления:

Предыдущее
От: Ken Tanzer
Дата:
Сообщение: Re: pg_config problems on PG9.3/Centos?
Следующее
От: Leonard Boyce
Дата:
Сообщение: composite foreign key performance