View Issue Details

IDProjectCategoryView StatusLast Update
0000159Pgpool-IIBugpublic2016-01-17 22:28
ReporterharukatAssigned Tot-ishii 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionopen 
Product Version3.4.0 
Target VersionFixed in Version 
Summary0000159: message ' getsockopt() detected error "Operation now in progress" '
DescriptionWe got the following error messages from pgpool-II 3.4.3.

2015-12-04 16:26:46 [No Connection] MAIN [No Connection] ERROR: failed to make persistent db connection
2015-12-04 16:26:46 [No Connection] MAIN [No Connection] DETAIL: connection to host:"10.1.1.13:5432" failed
2015-12-04 16:26:46 [No Connection] MAIN [No Connection] LOG: failed to connect to PostgreSQL server on "10.1.1.13:5432", getsockopt() detected error "Operation now in progress"

Function connect_with_timeout() in src/protocol/pool_connection_pool.c
has the following codes.

  if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &socklen) < 0)
  {
    /* Solaris returns error in this case */
    ereport(LOG,
      (errmsg("failed to connect to PostgreSQL server on \"%s:%d\",
      getsockopt() failed with error \"%s\"",host,port,strerror(errno))));
    return false;
  }
  /* Non Solaris case */
  if (error != 0)
  {
     ereport(LOG,
       (errmsg("failed to connect to PostgreSQL server on \"%s:%d\",
       getsockopt() detected error \"%s\"",host,port,strerror(errno))));
    return false;
  }

IMHO, in this case, "strerror(errno)" should be "strerror(error)".

Man connect(2) say "SO_ERROR is one of the usual error codes listed here,
explaining the reason for the failure" about EINPROGRESS.
TagsNo tags attached.

Activities

t-ishii

2015-12-07 15:27

developer   ~0000605

It is possible that connect_timeout is longer than health_check_timeout (or connect_timeout is 0). What are those values?

harukat

2015-12-20 18:26

developer   ~0000619

(Sorry. I delayed an answer for a long time.)

It may be so or may not be so.

The important thing is what does this code get the value of "error" by getsockopt() for.

t-ishii

2015-12-25 17:03

developer   ~0000625

I agree with "strerror(errno)" should be "strerror(error)".
But I doubt the logic below itself is incorrect.

  if (error != 0)
  {
     ereport(LOG,
       (errmsg("failed to connect to PostgreSQL server on \"%s:%d\",
       getsockopt() detected error \"%s\"",host,port,strerror(errno))));
    return false;
  }

t-ishii

2015-12-25 18:00

developer   ~0000626

Fix done. Note that the bug was introduced in 3.4. 3.3 is ok.

Issue History

Date Modified Username Field Change
2015-12-04 18:58 harukat New Issue
2015-12-07 15:27 t-ishii Note Added: 0000605
2015-12-07 15:27 t-ishii Assigned To => t-ishii
2015-12-07 15:27 t-ishii Status new => feedback
2015-12-20 18:26 harukat Note Added: 0000619
2015-12-20 18:26 harukat Status feedback => assigned
2015-12-25 17:03 t-ishii Note Added: 0000625
2015-12-25 18:00 t-ishii Note Added: 0000626
2016-01-17 22:28 t-ishii Status assigned => resolved