View Issue Details

IDProjectCategoryView StatusLast Update
0000233Pgpool-IIBugpublic2016-08-16 14:43
ReporterclonlineAssigned Tot-ishii 
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionopen 
PlatformOSCentOS 7OS Version
Product Version3.5.3 
Target VersionFixed in Version 
Summary0000233: an error message: ERROR: unable to read data from frontend DETAIL: EOF encountered with frontend.
DescriptionMy environment and settings:
OpenJDK: 1.7.0_111
JDBC URL: jdbc:postgresql://localhost:9999/DBNAME?protocolVersion=2
pgpool-II: 3.5.3
postgresql: 9.5.3

When I execute an java program accessing my database, pgpool-II always complains "ERROR: unable to read data from frontend DETAIL: EOF encountered with frontend.".Though there is that error message in the log file, select and update of data in the database seems successful.

If I don't use protocolVersion=2, the error message will not appear.
But,I must use the setting for my old codes.

log(pgpool.log):
[37-1] 2016-08-10 19:19:19 [12580] ERROR: unable to read data from frontend
[37-2] 2016-08-10 19:19:19 [12580] DETAIL: EOF encountered with frontend
[37-3] 2016-08-10 19:19:19 [12580] LOCATION: pool_stream.c:261
TagsNo tags attached.

Activities

t-ishii

2016-08-11 18:27

developer   ~0000980

In my case JDBC driver throws errors and which is the cause of the error.

18:10:31.394 (1) Switching to UTF8 client_encoding
18:10:31.394 (1) FE=> Query("begin; set autocommit = on; set client_encoding = 'UTF8'; SET extra_float_digits=3; commit")
18:10:31.395 (1) <=BE CommandStatus(BEGIN)
18:10:31.395 (1) <=BE ErrorResponse(ERROR: unrecognized configuration parameter "autocommit")
org.postgresql.util.PSQLException: ERROR: unrecognized configuration parameter "autocommit"

Note that "autocommit" was gone in PostgreSQL 9.5.0.

t-ishii

2016-08-12 10:46

developer   ~0000982

BTW, JDBC driver developers seem to decide to drop v2 protocol support.

https://github.com/pgjdbc/pgjdbc/pull/581#event-747434747

clonline

2016-08-12 13:12

reporter   ~0000984

Yes, It seems they will drop v2 protocol support.
davecramer(maintainer of driver) said "To be honest there shouldn't be any need to send it. New connections default to autocommit." on the url you provided.
They should know it is an issue.
But,I dont know whether they will fix it.

I want to use v3, but unfortunately, my old codes will fail.

I modified and built JDBC driver according to the code JCallico provided on the url.
The error about the parameter "autocommit" will not appear again by using the new driver.

If you would plan to debug the issue I reported, you could use the attached driver file.

postgresql-9.4.1210.jre7-SNAPSHOT.jar (685,442 bytes)

clonline

2016-08-12 17:27

reporter   ~0000985

Supplement:

If I use the below url,the same error will appear too.
 * jdbc:postgresql://localhost:9999/DBNAME?stringtype=unspecified
It is v3.

log:
2016-08-12 17:20:07 [21494] LOG: new connection received
2016-08-12 17:20:07 [21494] DETAIL: connecting host=xxx.xxx.xxx.xxx port=59086
2016-08-12 17:20:07 [21494] LOCATION: child.c:2110
2016-08-12 17:20:07 [21494] ERROR: unable to read data from frontend
2016-08-12 17:20:07 [21494] DETAIL: EOF encountered with frontend
2016-08-12 17:20:07 [21494] LOCATION: pool_stream.c:261

t-ishii

2016-08-12 17:54

developer   ~0000986

Can you connect to pgpool-II via psql?

psql -h localhost -p 9999 DBNAME....

clonline

2016-08-12 18:06

reporter   ~0000987

Yes, I can.

psql -h localhost -p 9999 -U usname DBNAME
ユーザ usname のパスワード:
psql (9.5.3)
"help" でヘルプを表示します.

DBNAME=#

t-ishii

2016-08-13 01:13

developer   ~0000989

Can you share self contained test case? I could not reproduce the problem.

clonline

2016-08-15 13:31

reporter   ~0000992

My test class:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;

public class TestClass {

    public static void main(String[] args) {
        Connection conn = null;
        String url = "jdbc:postgresql://xxxx.xxxx.xxxx.xxxx:9999/DBNAME?protocolVersion=3&stringtype=unspecified";
        System.out.println("-------- PostgreSQL JDBC Connection Testing ------------");
        try{
            Class.forName("org.postgresql.Driver");
            Properties props = new Properties();
            props.setProperty("user","username");
            props.setProperty("password","password");
            conn = DriverManager.getConnection(url, props);

            String sql = "select * from test_table where state=? and record_time < ?";
            PreparedStatement pstmt = conn.prepareStatement(sql);
            pstmt.setString(1, "O");
            pstmt.setString(2, "20160819");

            ResultSet result = pstmt.executeQuery();
            System.out.println("Query Result: " + result.toString());
        }catch(Exception e){
            e.printStackTrace();
        }finally{
            if(conn != null){
                try {
         // conn.close();
                }catch(Exception ex){
                    ex.printStackTrace();
                }
            }
        }
    }
}

if I comment out [conn.close();],
log:
[423-1] 2016-08-15 13:28:16 [1999] LOG: new connection received
[423-2] 2016-08-15 13:28:16 [1999] DETAIL: connecting host=xxx.xxx.xxx.xxx port=59166
[423-3] 2016-08-15 13:28:16 [1999] LOCATION: child.c:2110
[424-1] 2016-08-15 13:28:16 [1999] ERROR: unable to read data from frontend
[424-2] 2016-08-15 13:28:16 [1999] DETAIL: EOF encountered with frontend
[424-3] 2016-08-15 13:28:16 [1999] LOCATION: pool_stream.c:261

if I does not comment out [conn.close();],
log:
[425-1] 2016-08-15 13:29:12 [2011] LOG: new connection received
[425-2] 2016-08-15 13:29:12 [2011] DETAIL: connecting host=xxx.xxx.xxx.xxx port=59168
[425-3] 2016-08-15 13:29:12 [2011] LOCATION: child.c:2110
[426-1] 2016-08-15 13:29:12 [2011] LOG: statement: DISCARD ALL
[426-2] 2016-08-15 13:29:12 [2011] LOCATION: pool_proto_modules.c:129

clonline

2016-08-15 13:46

reporter   ~0000993

The case of commenting out [conn.close();], the logs are the same as my batch application.

I am checking which (seasar2 or postgresql driver) is sending a EOF to pgpool-ii.

By the way, could you tell me why pgpool-ii will output error logs(EOF) if recieving a EOF?
It seams the postgresql will not output error logs if it recieves a EOF.

t-ishii

2016-08-15 14:01

developer   ~0000994

Not reproduced here. By the way, is that really pgpool-II 3.5.3?

[423-1] 2016-08-15 13:28:16 [1999] LOG: new connection received
[423-2] 2016-08-15 13:28:16 [1999] DETAIL: connecting host=xxx.xxx.xxx.xxx port=59166
[423-3] 2016-08-15 13:28:16 [1999] LOCATION: child.c:2110

I don't see this on child.c:2110.

clonline

2016-08-15 14:15

reporter   ~0000995

It is pgpool-II 3.5.3.

************************************************************************
[root@hostname# rpm -qa | grep -i pgpool
pgpool-II-95-3.5.3-1.rhel7.x86_64
************************************************************************

I don't know whether child.c:2110 is correct.

In the pgpool.conf, I have done the settings like the below.
Then, [LOCATION: child.c:2110] is wrote into the log file.

************************************************************************
# - Debug -
#debug_level = 0
debug_level = 1

#log_error_verbosity = default # terse, default, or verbose messages
log_error_verbosity = verbose # terse, default, or verbose messages

client_min_messages = notice # values in order of decreasing detail:
#client_min_messages = log # values in order of decreasing detail:

log_min_messages = warning # values in order of decreasing detail:
#log_min_messages = log # values in order of decreasing detail:
************************************************************************

t-ishii

2016-08-15 14:25

developer   ~0000996

Seems different from our RPM.
Ours is:
pgpool-II-pg95-3.5.3-1pgdg.rhel7.x86_64

clonline

2016-08-15 16:47

reporter   ~0000997

I uninstalled pgpool-II-95-3.5.3-1.rhel7.x86_64
and installed pgpool-II-pg95-3.5.3-1pgdg.rhel7.x86_64.

************************************************************************
 [root@hostname# rpm -qa | grep -i pgpool
 pgpool-II-pg95-3.5.3-1pgdg.rhel7.x86_64
************************************************************************

It seams error logs are same.
I think which threw errors is [pool_stream.c:261].
************************************************************************
[9-1] 2016-08-15 16:39:43 [2932] LOG: new connection received
[9-2] 2016-08-15 16:39:43 [2932] DETAIL: connecting host=xxx.xxx.xxx.xxx port=59190
[9-3] 2016-08-15 16:39:43 [2932] LOCATION: child.c:2110
[10-1] 2016-08-15 16:39:43 [2932] ERROR: unable to read data from frontend
[10-2] 2016-08-15 16:39:43 [2932] DETAIL: EOF encountered with frontend
[10-3] 2016-08-15 16:39:43 [2932] LOCATION: pool_stream.c:261
************************************************************************

t-ishii

2016-08-15 18:00

developer   ~0000998

If you execute the Java program on the same machine pgpool-II is running on and specify the URL "localhost", do you see still the error?

clonline

2016-08-16 12:34

reporter   ~0001003

>>If you execute the Java program on the same machine pgpool-II is running on and specify the URL "localhost", do you see still the error?

I specified the "localhost" in the url and executed the java test program.
The same error logs appeared.
************************************************************************
String url = "jdbc:postgresql://localhost:9999/DBNAME?protocolVersion=3&stringtype=unspecified";
************************************************************************

Through trying many times,
I understood why EOF error logs appeared after executing my application.
I have not closed the connection to the postgresql database.
If I call the method(seasar2's destory) to close the connection,
the EOF error will not appear in the pgpool log file.

It seams the EOF error will appear in the pgpool log file if not closing the connection to the postgresql database.

I will modify my appliaction and add the codes for closing the connections.

Thank you for your help!

t-ishii

2016-08-16 12:53

developer   ~0001004

Can you please elaborate more? So conn.close() does not actually close the connection to the PostgreSQL?

clonline

2016-08-16 13:26

reporter   ~0001005

If we focus on my test java,it will maybe be simple.

In my test java(0000233:0000992) , I commented out [conn.close()].
So actually did not close the connection to the PostgreSQL.

I tried the cases like below through the test java.
case1: comment out [conn.close()]
 =>result: EOF errors appear

case2: not comment out [conn.close()]
 =>result: EOF errors not appear

t-ishii

2016-08-16 14:42

developer   ~0001006

Thanks for the explanation. I am going to change the issue status to "resolved."

Issue History

Date Modified Username Field Change
2016-08-10 19:37 clonline New Issue
2016-08-11 17:33 t-ishii Assigned To => t-ishii
2016-08-11 17:33 t-ishii Status new => assigned
2016-08-11 18:27 t-ishii Note Added: 0000980
2016-08-11 18:34 t-ishii Status assigned => feedback
2016-08-12 10:46 t-ishii Note Added: 0000982
2016-08-12 13:12 clonline File Added: postgresql-9.4.1210.jre7-SNAPSHOT.jar
2016-08-12 13:12 clonline Note Added: 0000984
2016-08-12 13:12 clonline Status feedback => assigned
2016-08-12 17:27 clonline Note Added: 0000985
2016-08-12 17:54 t-ishii Note Added: 0000986
2016-08-12 17:54 t-ishii Status assigned => feedback
2016-08-12 18:06 clonline Note Added: 0000987
2016-08-12 18:06 clonline Status feedback => assigned
2016-08-13 01:13 t-ishii Note Added: 0000989
2016-08-13 01:14 t-ishii Status assigned => feedback
2016-08-15 13:31 clonline Note Added: 0000992
2016-08-15 13:31 clonline Status feedback => assigned
2016-08-15 13:46 clonline Note Added: 0000993
2016-08-15 14:01 t-ishii Note Added: 0000994
2016-08-15 14:01 t-ishii Status assigned => feedback
2016-08-15 14:15 clonline Note Added: 0000995
2016-08-15 14:15 clonline Status feedback => assigned
2016-08-15 14:25 t-ishii Note Added: 0000996
2016-08-15 16:47 clonline Note Added: 0000997
2016-08-15 18:00 t-ishii Note Added: 0000998
2016-08-16 07:40 t-ishii Status assigned => feedback
2016-08-16 12:34 clonline Note Added: 0001003
2016-08-16 12:34 clonline Status feedback => assigned
2016-08-16 12:53 t-ishii Note Added: 0001004
2016-08-16 13:26 clonline Note Added: 0001005
2016-08-16 14:42 t-ishii Note Added: 0001006
2016-08-16 14:43 t-ishii Status assigned => resolved