pgpool / pgpool2

This is the official mirror of git://git.postgresql.org/git/pgpool2.git. Note that this is just a *mirror* - we don't work with pull requests on github. Please subscribe to pgpool-hackers mailing list from our website and submit your patch to this mailing list.
https://www.pgpool.net
Other
326 stars 88 forks source link

Socket locked when start software #24

Open asterissco opened 5 years ago

asterissco commented 5 years ago

Hello!!

I killed the proccess (and sons with -9), remove .PSQL on /tmp, and when I try to launch pgpool broke and that logged this

Feb 22 08:32:58 pgpool-test pgpool4-01[5228]: [6-1] 2019-02-22 08:32:58: pid 5228: LOG:  Backend status file /tmp/pgpool-4.0.1/pgpool_status does not exist
Feb 22 08:32:58 pgpool-test pgpool4-01[5228]: [7-1] 2019-02-22 08:32:58: pid 5228: DEBUG:  pool_coninfo_size: num_init_children (80) * max_pool (4) * MAX_NUM_BACKENDS (128) * sizeof(ConnectionInfo) (136) = 5570560 bytes requested for shared memory
Feb 22 08:32:58 pgpool-test pgpool4-01[5228]: [8-1] 2019-02-22 08:32:58: pid 5228: DEBUG:  ProcessInfo: num_init_children (80) * sizeof(ProcessInfo) (32) = 2560 bytes requested for shared memory
Feb 22 08:32:58 pgpool-test pgpool4-01[5228]: [9-1] 2019-02-22 08:32:58: pid 5228: DEBUG:  Request info are: sizeof(POOL_REQUEST_INFO) 5264 bytes requested for shared memory
Feb 22 08:32:58 pgpool-test pgpool4-01[5228]: [10-1] 2019-02-22 08:32:58: pid 5228: DEBUG:  Recovery management area: sizeof(int) 4 bytes requested for shared memory
Feb 22 08:32:58 pgpool-test pgpool4-01[5228]: [11-1] 2019-02-22 08:32:58: pid 5228: FATAL:  failed to bind a socket: "/tmp/pgpool-4.0.1/.s.PGSQL.6432"
Feb 22 08:32:58 pgpool-test pgpool4-01[5228]: [11-2] 2019-02-22 08:32:58: pid 5228: DETAIL:  bind socket failed with error: "Address already in use"

bind socket failed with error: "Address already in use" but

root@pgpool-test:/var/log# netstat -lptn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2025/sshd           
tcp6       0      0 :::22                   :::*                    LISTEN      2025/sshd           

root@pgpool-test:/var/log# ss -lnm |grep -i -e 5432 -e 6432

root@pgpool-test:/var/log# nmap -sT -O localhost

Starting Nmap 7.40 ( https://nmap.org ) at 2019-02-22 08:37 WET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000097s latency).
Other addresses for localhost (not scanned): ::1
Not shown: 999 closed ports
PORT   STATE SERVICE
22/tcp open  ssh
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.8 - 4.6
Network Distance: 0 hops

OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 2.21 seconds

root@pgpool-test:/var/log# ncat -l 6432
Hello!!
^C

root@pgpool-test:/var/log# ncat -l 5432
Hello Again!!
^C

The system release the socket. I change source code to verify IP and PORT build the socket and compile again

root@pgpool-test:/usr/src/pgpool-II-4.0.3# vim src/main/pgpool_main.c 
   248  
   249          ereport(NOTICE,
   250                 (errmsg("CONF-IP: "),
   251                       errdetail(" \"%s\"",pool_config->listen_addresses )));
   252  
   253          ereport(NOTICE,
   254                 (errmsg("CONF-PORT: "),
   255                       errdetail(" \"%i\"",pool_config->port )));
   256  
   257       

I can to confirm that IP and PORT is ok and release, and happen again,

root@pgpool-test:/usr/src/pgpool-II-4.0.3# cat /var/log/syslog |tail
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [5-1] 2019-02-22 09:23:33: pid 10345: NOTICE:  CONF-IP:
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [5-2] 2019-02-22 09:23:33: pid 10345: DETAIL:   "192.168.2.235"
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [6-1] 2019-02-22 09:23:33: pid 10345: NOTICE:  CONF-PORT:
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [6-2] 2019-02-22 09:23:33: pid 10345: DETAIL:   "6432"
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [7-1] 2019-02-22 09:23:33: pid 10345: DEBUG:  pool_coninfo_size: num_init_children (80) * max_pool (4) * MAX_NUM_BACKENDS (128) * sizeof(ConnectionInfo) (136) = 5570560 bytes requested for shared memory
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [8-1] 2019-02-22 09:23:33: pid 10345: DEBUG:  ProcessInfo: num_init_children (80) * sizeof(ProcessInfo) (32) = 2560 bytes requested for shared memory
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [9-1] 2019-02-22 09:23:33: pid 10345: DEBUG:  Request info are: sizeof(POOL_REQUEST_INFO) 5264 bytes requested for shared memory
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [10-1] 2019-02-22 09:23:33: pid 10345: DEBUG:  Recovery management area: sizeof(int) 4 bytes requested for shared memory
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [11-1] 2019-02-22 09:23:33: pid 10345: FATAL:  failed to bind a socket: "/tmp/pgpool-4.0.1/.s.PGSQL.6432"
Feb 22 09:23:33 debian-cypress-pgpool41 pgpool4-01[10345]: [11-2] 2019-02-22 09:23:33: pid 10345: DETAIL:  bind socket failed with error: "Address already in use"

The only fixed is reeboot the system.

Thanks!!

asterissco commented 5 years ago

I fixed, locked files is hidden and i remove correctly

rm -r /tmp/pgpool-4.0.1/.s.PGSQL.*

Sorry xD

Prasanna429 commented 5 years ago

yes removing #rm -f .s.PGSQL.* and restart the service...it works for me