init scripts don't return the proper exit codes

Bug #1491872 reported by Adrian Smith
58
This bug affects 14 people
Affects Status Importance Assigned to Milestone
OpenContrail
New
Undecided
Unassigned

Bug Description

The init scripts for the services listed below don't return the proper exit codes (according to LSB[1]).

For example, running "service contrail-api status" should return 3 if the service is down. The script actually returns 0. This becomes a problem when using tools like chef that use this exist code to determine weather the service needs to be started.

Affected scripts (grouped by node type)

analytics
* contrail-analytics-api
* contrail-collector
* contrail-query-engine

cfgm
* ifmap
* contrail-discovery
* contrail-svc-monitor
* contrail-api
* contrail-schema
* contrail-device-manager

control
* contrail-control
* contrail-dns

database
* contrail-database

rabbitmq
* rabbitmq-server

webui
* contrail-webui
* contrail-webui-middleware

For example, here's the contrail-api init script, https://github.com/Juniper/contrail-controller/blob/0d0dcbfa6a0adf07a554a691180557b62bdce3c3/src/config/api-server/contrail-api.initd.supervisord

[1] http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

Tags: packaging
description: updated
description: updated
description: updated
Revision history for this message
Andrey Kirilochkin (andreika-mail) wrote :

This bug affects us very much. (Mirantis)

root@contrail-db-15427:/var/lib/fuel# nc -l 5997
root@contrail-db-15427:/var/lib/fuel# /usr/bin/contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf --worker_id 0
08/02/2016 10:53:43 PM [contrail-discovery]: SANDESH: CONNECT TO COLLECTOR: True
08/02/2016 10:53:43 PM [contrail-discovery]: Unable to open HTTP Port 5997, [Errno 98] Address already in use
root@contrail-db-15427:/var/lib/fuel# echo $?
0

Our workaround was to change the "exitcodes" to something unusual to make service restart infinitely until it reaches the "startretries":

[program:contrail-discovery]
command=/usr/bin/contrail-discovery --conf_file /etc/contrail/contrail-discovery.conf --worker_id %(process_num)s
numprocs=1
process_name=%(process_num)s
redirect_stderr=true
stdout_logfile= /var/log/contrail/contrail-discovery-%(process_num)s-stdout.log
stderr_logfile=/dev/null
priority=430
autostart=true
killasgroup=true
stopsignal=KILL
exitcodes=222 ;'expected' exit codes for process (default 0,2)
startretries=10
user=contrail

Please fix services return non-zero exit code when it crashes.

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.