Skip to content

Commit 9299a24

Browse files
committed
Revert "[201803] [services] Restart SwSS service upon unexpected critical process exit (#2546)"
This reverts commit 2a8af27.
1 parent 968a0df commit 9299a24

File tree

19 files changed

+60
-127
lines changed

19 files changed

+60
-127
lines changed
Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
#!/usr/bin/env bash
22

3-
STATE_DB_IDX="6"
4-
5-
PORT_TABLE_PREFIX="PORT_TABLE"
6-
VLAN_TABLE_PREFIX="VLAN_TABLE"
7-
LAG_TABLE_PREFIX="LAG_TABLE"
8-
93
function wait_until_iface_ready
104
{
11-
TABLE_PREFIX=$1
12-
IFACE=$2
5+
IFACE=$1
6+
7+
echo "Waiting until interface $IFACE is up..."
8+
9+
# Wait for the interface to come up (i.e., 'ip link show' returns 0)
10+
until ip link show dev $IFACE up > /dev/null 2>&1; do
11+
sleep 1
12+
done
1313

14-
echo "Waiting until interface $IFACE is ready..."
14+
echo "Interface $IFACE is up"
1515

16-
# Wait for the interface to come up
17-
# (i.e., interface is present in STATE_DB and state is "ok")
16+
echo "Waiting until interface $IFACE has an IPv4 address..."
17+
18+
# Wait until the interface gets assigned an IPv4 address
1819
while true; do
19-
RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null)
20-
if [ x"$RESULT" == x"ok" ]; then
20+
IP=$(ip -4 addr show dev $IFACE | grep "inet " | awk '{ print $2 }' | cut -d '/' -f1)
21+
22+
if [ -n "$IP" ]; then
2123
break
2224
fi
2325

2426
sleep 1
2527
done
2628

27-
echo "Interface ${IFACE} is ready!"
29+
echo "Interface $IFACE is configured with IP $IP"
2830
}
2931

3032

31-
# Wait for all interfaces to be up and ready
33+
# Wait for all interfaces to come up and have IPv4 addresses assigned
3234
{% for (name, prefix) in INTERFACE %}
33-
wait_until_iface_ready ${PORT_TABLE_PREFIX} {{ name }}
35+
wait_until_iface_ready {{ name }}
3436
{% endfor %}
3537
{% for (name, prefix) in VLAN_INTERFACE %}
36-
wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }}
38+
wait_until_iface_ready {{ name }}
3739
{% endfor %}
3840
{% for (name, prefix) in PORTCHANNEL_INTERFACE %}
39-
wait_until_iface_ready ${LAG_TABLE_PREFIX} {{ name }}
41+
wait_until_iface_ready {{ name }}
4042
{% endfor %}

dockers/docker-orchagent/Dockerfile.j2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ COPY ["files/arp_update", "/usr/bin"]
3030
COPY ["enable_counters.py", "/usr/bin"]
3131
COPY ["start.sh", "orchagent.sh", "swssconfig.sh", "/usr/bin/"]
3232
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
33-
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
34-
COPY ["critical_processes", "/etc/supervisor/"]
3533

3634
## Copy all Jinja2 template files into the templates folder
3735
COPY ["*.j2", "/usr/share/sonic/templates/"]

dockers/docker-orchagent/critical_processes

Lines changed: 0 additions & 7 deletions
This file was deleted.

dockers/docker-orchagent/supervisord.conf

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ logfile_maxbytes=1MB
33
logfile_backups=2
44
nodaemon=true
55

6-
[eventlistener:supervisor-proc-exit-listener]
7-
command=/usr/bin/supervisor-proc-exit-listener
8-
events=PROCESS_STATE_EXITED
9-
autostart=true
10-
autorestart=unexpected
11-
126
[program:start.sh]
137
command=/usr/bin/start.sh
148
priority=1
@@ -21,7 +15,7 @@ stderr_logfile=syslog
2115
command=/usr/sbin/rsyslogd -n
2216
priority=2
2317
autostart=false
24-
autorestart=unexpected
18+
autorestart=false
2519
stdout_logfile=syslog
2620
stderr_logfile=syslog
2721

files/build_templates/dhcp_relay.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{ docker_container_name }}.sh attach
1111
ExecStop=/usr/bin/{{ docker_container_name }}.sh stop
1212

1313
[Install]
14-
WantedBy=multi-user.target swss.service teamd.service
14+
WantedBy=multi-user.target teamd.service

files/build_templates/radv.service.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{ docker_container_name }}.sh attach
1111
ExecStop=/usr/bin/{{ docker_container_name }}.sh stop
1212

1313
[Install]
14-
WantedBy=multi-user.target swss.service
14+
WantedBy=multi-user.target

files/build_templates/snmp.service.j2

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,3 @@ Before=ntp-config.service
88
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
99
ExecStart=/usr/bin/{{docker_container_name}}.sh attach
1010
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
11-
12-
[Install]
13-
WantedBy=multi-user.target swss.service

files/build_templates/swss.service.j2

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ After=opennsl-modules-3.16.0-6-amd64.service
1414
After=nps-modules-3.16.0-6-amd64.service
1515
{% endif %}
1616
Before=ntp-config.service
17-
StartLimitInterval=1200
18-
StartLimitBurst=3
1917

2018
[Service]
2119
User=root
@@ -54,8 +52,6 @@ ExecStopPost=/usr/bin/mst stop
5452
ExecStopPost=/etc/init.d/xpnet.sh stop
5553
ExecStopPost=/etc/init.d/xpnet.sh start
5654
{% endif %}
57-
Restart=always
58-
RestartSec=30
5955

6056
[Install]
6157
WantedBy=multi-user.target
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Unit]
22
Description=TEAMD container
3-
Requires=updategraph.service swss.service
4-
After=updategraph.service swss.service
3+
Requires=updategraph.service
4+
After=updategraph.service
55
Before=ntp-config.service
66

77
[Service]
@@ -11,4 +11,4 @@ ExecStart=/usr/bin/{{docker_container_name}}.sh attach
1111
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
1212

1313
[Install]
14-
WantedBy=multi-user.target swss.service
14+
WantedBy=multi-user.target

files/scripts/supervisor-proc-exit-listener

Lines changed: 0 additions & 45 deletions
This file was deleted.

platform/broadcom/docker-orchagent-brcm.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ $(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
1616
$(DOCKER_ORCHAGENT_BRCM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
1717

1818
$(DOCKER_ORCHAGENT_BRCM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
19-
$(DOCKER_ORCHAGENT_BRCM)_FILES += $(ARP_UPDATE_SCRIPT) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
19+
$(DOCKER_ORCHAGENT_BRCM)_FILES += $(ARP_UPDATE_SCRIPT)

platform/cavium/docker-orchagent-cavm.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ $(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
1616
$(DOCKER_ORCHAGENT_CAVM)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
1717

1818
$(DOCKER_ORCHAGENT_CAVM)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
19-
$(DOCKER_ORCHAGENT_CAVM)_FILES += $(ARP_UPDATE_SCRIPT) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
19+
$(DOCKER_ORCHAGENT_CAVM)_FILES += $(ARP_UPDATE_SCRIPT)

platform/centec/docker-orchagent-centec.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ $(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
1616
$(DOCKER_ORCHAGENT_CENTEC)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
1717

1818
$(DOCKER_ORCHAGENT_CENTEC)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
19-
$(DOCKER_ORCHAGENT_CENTEC)_FILES += $(ARP_UPDATE_SCRIPT) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
19+
$(DOCKER_ORCHAGENT_CENTEC)_FILES += $(ARP_UPDATE_SCRIPT)

platform/marvell/docker-orchagent-mrvl.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ $(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /host/machine.conf:/host/machine.conf
1515
$(DOCKER_ORCHAGENT_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
1616

1717
$(DOCKER_ORCHAGENT_MRVL)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
18-
$(DOCKER_ORCHAGENT_MRVL)_FILES += $(ARP_UPDATE_SCRIPT) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
18+
$(DOCKER_ORCHAGENT_MRVL)_FILES += $(ARP_UPDATE_SCRIPT)

platform/mellanox/docker-orchagent-mlnx.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ $(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
1616
$(DOCKER_ORCHAGENT_MLNX)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
1717

1818
$(DOCKER_ORCHAGENT_MLNX)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
19-
$(DOCKER_ORCHAGENT_MLNX)_FILES += $(ARP_UPDATE_SCRIPT) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
19+
$(DOCKER_ORCHAGENT_MLNX)_FILES += $(ARP_UPDATE_SCRIPT)

platform/nephos/docker-orchagent-nephos.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ $(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
1616
$(DOCKER_ORCHAGENT_NEPHOS)_RUN_OPT += -v /var/log/swss:/var/log/swss:rw
1717

1818
$(DOCKER_ORCHAGENT_NEPHOS)_BASE_IMAGE_FILES += swssloglevel:/usr/bin/swssloglevel
19-
$(DOCKER_ORCHAGENT_NEPHOS)_FILES += $(ARP_UPDATE_SCRIPT) $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
19+
$(DOCKER_ORCHAGENT_NEPHOS)_FILES += $(ARP_UPDATE_SCRIPT)

rules/docker-dhcp-relay.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
DOCKER_DHCP_RELAY = docker-dhcp-relay.gz
44
$(DOCKER_DHCP_RELAY)_PATH = $(DOCKERS_PATH)/docker-dhcp-relay
5-
$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) $(ISC_DHCP_CLIENT) $(REDIS_TOOLS)
5+
$(DOCKER_DHCP_RELAY)_DEPENDS += $(ISC_DHCP_COMMON) $(ISC_DHCP_RELAY) $(ISC_DHCP_CLIENT)
66
$(DOCKER_DHCP_RELAY)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE)
77
SONIC_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)
88
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_DHCP_RELAY)

rules/scripts.mk

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ $(ARP_UPDATE_SCRIPT)_PATH = files/scripts
55
CONFIGDB_LOAD_SCRIPT = configdb-load.sh
66
$(CONFIGDB_LOAD_SCRIPT)_PATH = files/scripts
77

8-
SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT = supervisor-proc-exit-listener
9-
$(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)_PATH = files/scripts
10-
118
SONIC_COPY_FILES += $(CONFIGDB_LOAD_SCRIPT) \
12-
$(ARP_UPDATE_SCRIPT) \
13-
$(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
9+
$(ARP_UPDATE_SCRIPT)
1410

1511

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
11
#!/usr/bin/env bash
22

3-
STATE_DB_IDX="6"
4-
5-
PORT_TABLE_PREFIX="PORT_TABLE"
6-
VLAN_TABLE_PREFIX="VLAN_TABLE"
7-
LAG_TABLE_PREFIX="LAG_TABLE"
8-
93
function wait_until_iface_ready
104
{
11-
TABLE_PREFIX=$1
12-
IFACE=$2
5+
IFACE=$1
6+
7+
echo "Waiting until interface $IFACE is up..."
8+
9+
# Wait for the interface to come up (i.e., 'ip link show' returns 0)
10+
until ip link show dev $IFACE up > /dev/null 2>&1; do
11+
sleep 1
12+
done
1313

14-
echo "Waiting until interface $IFACE is ready..."
14+
echo "Interface $IFACE is up"
1515

16-
# Wait for the interface to come up
17-
# (i.e., interface is present in STATE_DB and state is "ok")
16+
echo "Waiting until interface $IFACE has an IPv4 address..."
17+
18+
# Wait until the interface gets assigned an IPv4 address
1819
while true; do
19-
RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null)
20-
if [ x"$RESULT" == x"ok" ]; then
20+
IP=$(ip -4 addr show dev $IFACE | grep "inet " | awk '{ print $2 }' | cut -d '/' -f1)
21+
22+
if [ -n "$IP" ]; then
2123
break
2224
fi
2325

2426
sleep 1
2527
done
2628

27-
echo "Interface ${IFACE} is ready!"
29+
echo "Interface $IFACE is configured with IP $IP"
2830
}
2931

3032

31-
# Wait for all interfaces to be up and ready
32-
wait_until_iface_ready ${VLAN_TABLE_PREFIX} Vlan1000
33-
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel04
34-
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel02
35-
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel03
36-
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel03
37-
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel01
38-
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel02
39-
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel04
40-
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel01
33+
# Wait for all interfaces to come up and have IPv4 addresses assigned
34+
wait_until_iface_ready Vlan1000
35+
wait_until_iface_ready PortChannel04
36+
wait_until_iface_ready PortChannel02
37+
wait_until_iface_ready PortChannel03
38+
wait_until_iface_ready PortChannel03
39+
wait_until_iface_ready PortChannel01
40+
wait_until_iface_ready PortChannel02
41+
wait_until_iface_ready PortChannel04
42+
wait_until_iface_ready PortChannel01
4143

0 commit comments

Comments
 (0)