pgpool2 cannot start after reboot

Bug #1078937 reported by John-Scott Atlakson
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pgpool2 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu

Description: Ubuntu 12.04.1 LTS
Release: 12.04

2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center

pgpool2:
  Installed: 3.1.1-1
  Candidate: 3.1.1-1
  Version table:
 *** 3.1.1-1 0
        500 http://mirror.rackspace.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status

3) What you expected to happen

pgpool2, like all other long-running services, should automatically start after a reboot.

4) What happened instead

pgpool2 fails to restart after reboot because the /var/run/postgresql directory is missing. From /var/syslog:

Nov 14 20:51:57 test-app pgpool: 2012-11-14 20:51:57 ERROR: pid 1300: could not open pid file as /var/run/postgresql/pgpool.pid. reason: No such file or directory

This is a regression of a bug that was addressed years ago but apparently wasn't fixed upstream, so it's been reintroduced (see => https://bugs.launchpad.net/ubuntu/+source/pgpool2/+bug/314837).

The /etc/init.d/pgpool2 script needs to follow convention and source /usr/share/postgresql-common/init.d-functions which internally ensures /var/run/postgresql exists. However, if you call `/etc/init.d/pgpool2 start`, this internally calls 'd_start()', so the 'start()' function in the init.d-functions is never called, so in this case it's not as simple as just sourcing the common init.d-functions. For now I've monkey-patched /etc/init.d/pgpool2's d_start() function:

d_start() {
        if is_running; then
                :
        else
                # create socket directory
                if [ -d /var/run/postgresql ]; then
                    chmod 2775 /var/run/postgresql
                else
                    install -d -m 2775 -o postgres -g postgres /var/run/postgresql
                fi
                su -c "$DAEMON -n $OPTS 2>&1 </dev/null | logger -t pgpool -p ${PGPOOL_SYSLOG_FACILITY:-local0}.info >/dev/null 2>&1 &" - postgres
        fi
}

Here are the minimum steps to reproduce on a new install:

root@test-app:~# apt-get update && sudo apt-get upgrade && sudo apt-get install pgpool2
The following extra packages will be installed:
  libpgpool0 libpq5 postgresql-client-common postgresql-common ssl-cert

root@test-app:~# ls /var/run/postgresql/
pgpool.pid

root@test-app:~# reboot

root@test-app:~# ls /var/run/postgresql/
ls: cannot access /var/run/postgresql/: No such file or directory

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pgpool2 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.