Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-22555

couchbase-server.pid is not cleaned up

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 5.0.0
    • 4.5.1
    • installer
    • None

    Description

      At present, we touch the PID file /opt/couchbase/var/lib/couchbase/couchbase-server.pid as part of the init.d script and write to it (if I'm not mistaken) here.

      However on shutdown we never clean this up, for example:

      $ sudo cat /opt/couchbase/var/lib/couchbase/couchbase-server.pid
      6459
       
      $ ps -p 6459
        PID TTY          TIME CMD
       6459 ?        00:00:03 beam.smp
       
      $ sudo /etc/init.d/couchbase-server stop
      Stopping couchbase-server
                                                                 [  OK  ]
      $ sudo cat /opt/couchbase/var/lib/couchbase/couchbase-server.pid
      6459
      $ ps -p 6459
        PID TTY          TIME CMD
      

      We also check the pid file as part of the init.d script:

      running() {
          pidofproc -p $PIDFILE $DAEMON >/dev/null
          errcode=$?
          return $errcode
      }
       
      case $1 in
          start)
              if running ; then
                  warning && echo "couchbase-server is already started"
                  exit 0
              fi
              echo -n $'Starting couchbase-server\n'
              start
              echo
              ;;
       
      ...
      

      This can become a problem after a reboot if another process is now running under the previous PID, as the init.d script will return:

      $ sudo /etc/init.d/couchbase-server start
      couchbase-server is already started                        [WARNING]
      

      In this case, I manually set the PID file to have a PID I knew would clash, but we have seen cases where this happens "organically".

      Admittedly, I'm not sure what the best solution is here, but I wanted to highlight the problem.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              James Flather James Flather (Inactive)
              James Flather James Flather (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty