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

Improve the way systemd stops couchbase server (was: systemd kills couchbase server if 'couchbase -k' returns error)

    XMLWordPrintable

Details

    Description

      Systemd stops the process when the service is stopped on an installed version of the server even if 'couchbase-server -k' returns error code. Moreover, it looks like systemd kills the process brutally - which is not good for items that may be in disk write queues at the time the service is stopped.

      Can be reproduced by modifying the couchbase-server script the following way:

      1) Add 'return 1' in the beginning of function _stop() in /opt/couchbase/bin/couchbase-server

      2) Call 'service couchbase-server stop'

      After that status shows:

      # service couchbase-server status
      ● couchbase-server.service - Couchbase Server
       Loaded: loaded (/lib/systemd/system/couchbase-server.service; enabled; vendor preset: enabled)
       Active: failed (Result: exit-code) since Fri 2019-11-22 23:16:40 UTC; 3s ago
       Docs: http://docs.couchbase.com
       Process: 22333 ExecStop=/opt/couchbase/bin/couchbase-server -k (code=exited, status=1/FAILURE)
       Process: 22015 ExecStart=/opt/couchbase/bin/couchbase-server -- -noinput (code=killed, signal=TERM)
       Main PID: 22015 (code=killed, signal=TERM)
       
      Nov 22 23:16:29 alpha systemd[1]: Started Couchbase Server.
      Nov 22 23:16:31 alpha couchbase[22015]: \{error_logger,{{2019,11,22},\{23,16,31}},"global_trace:~n~p",[{loo
      Nov 22 23:16:40 alpha systemd[1]: Stopping Couchbase Server...
      Nov 22 23:16:40 alpha systemd[1]: couchbase-server.service: Control process exited, code=exited status=1
      Nov 22 23:16:40 alpha systemd[1]: Stopped Couchbase Server.
      Nov 22 23:16:40 alpha systemd[1]: couchbase-server.service: Unit entered failed state.
      Nov 22 23:16:40 alpha systemd[1]: couchbase-server.service: Failed with result 'exit-code'.
      

       

      Attachments

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

        Activity

          People

            dfinlay Dave Finlay
            timofey.barmin Timofey Barmin
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty