From 7bf05f7f4fddca5a3af0e55d07c06e31937e9215 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Thu, 19 Nov 2020 23:41:32 -0800 Subject: [PATCH] [supervisor] Install vanilla package once again, install Python 3 version in Buster container (#5546) **- Why I did it** We were building a custom version of Supervisor because I had added patches to prevent hangs and crashes if the system clock ever rolled backward. Those changes were merged into the upstream Supervisor repo as of version 3.4.0 (http://supervisord.org/changes.html#id9), therefore, we should be able to simply install the vanilla package via pip. This will also allow us to easily move to Python 3, as Python 3 support was added in version 4.0.0. **- How I did it** - Remove Makefiles and patches for building supervisor package from source - Install Python 3 supervisor package version 4.2.1 in Buster base container - Also install Python 3 version of supervisord-dependent-startup in Buster base container - Debian package installed binary in `/usr/bin/`, but pip package installs in `/usr/local/bin/`, so rather than update all absolute paths, I changed all references to simply call `supervisord` and let the system PATH find the executable to prevent future need for changes just in case we ever need to switch back to build a Debian package, then we won't need to modify these again. - Install Python 2 supervisor package >= 3.4.0 in Stretch and Jessie base containers --- .../pmon_daemon_control.json | 1 + dockers/docker-base-buster/Dockerfile.j2 | 22 +- dockers/docker-base-stretch/Dockerfile.j2 | 22 +- dockers/docker-base/Dockerfile.j2 | 10 +- dockers/docker-basic_router/Dockerfile | 2 +- .../docker-database/docker-database-init.sh | 4 +- .../docker-dhcp-relay.supervisord.conf.j2 | 2 +- dockers/docker-dhcp-relay/docker_init.sh | 2 +- dockers/docker-fpm-frr/docker_init.sh | 2 +- .../frr/supervisord/supervisord.conf.j2 | 2 +- dockers/docker-fpm-gobgp/Dockerfile.j2 | 2 +- dockers/docker-fpm-quagga/Dockerfile.j2 | 2 +- dockers/docker-iccpd/Dockerfile.j2 | 2 +- dockers/docker-iccpd/supervisord.conf | 2 +- dockers/docker-lldp/docker-lldp-init.sh | 2 +- dockers/docker-lldp/supervisord.conf.j2 | 2 +- dockers/docker-nat/Dockerfile.j2 | 3 +- dockers/docker-nat/supervisord.conf | 2 +- dockers/docker-orchagent/docker-init.sh | 2 +- dockers/docker-orchagent/supervisord.conf | 2 +- .../docker-pmon.supervisord.conf.j2 | 2 +- .../docker-platform-monitor/docker_init.sh | 2 +- .../docker-router-advertiser/docker-init.sh | 2 +- ...cker-router-advertiser.supervisord.conf.j2 | 2 +- dockers/docker-sflow/Dockerfile.j2 | 2 +- dockers/docker-sflow/supervisord.conf | 2 +- dockers/docker-snmp/Dockerfile.j2 | 2 +- dockers/docker-snmp/supervisord.conf | 2 +- .../docker-sonic-mgmt-framework/Dockerfile.j2 | 2 +- .../supervisord.conf | 2 +- dockers/docker-sonic-restapi/Dockerfile.j2 | 2 +- dockers/docker-sonic-restapi/supervisord.conf | 2 +- dockers/docker-sonic-telemetry/Dockerfile.j2 | 2 +- .../docker-sonic-telemetry/supervisord.conf | 2 +- dockers/docker-teamd/Dockerfile.j2 | 2 +- dockers/docker-teamd/supervisord.conf | 2 +- files/scripts/supervisor-proc-exit-listener | 7 +- .../barefoot/docker-saiserver-bfn/Dockerfile | 3 +- .../docker-syncd-bfn-rpc/Dockerfile.j2 | 3 +- .../barefoot/docker-syncd-bfn/Dockerfile.j2 | 3 +- .../docker-syncd-bfn/supervisord.conf | 2 +- .../docker-saiserver-brcm/Dockerfile.j2 | 2 +- .../docker-syncd-brcm-rpc/Dockerfile.j2 | 2 +- .../broadcom/docker-syncd-brcm/Dockerfile.j2 | 2 +- .../docker-syncd-brcm/supervisord.conf | 2 +- .../cavium/docker-saiserver-cavm/Dockerfile | 2 +- .../docker-syncd-cavm-rpc/Dockerfile.j2 | 2 +- .../cavium/docker-syncd-cavm/Dockerfile.j2 | 2 +- .../docker-syncd-centec-rpc/Dockerfile.j2 | 2 +- .../docker-syncd-centec/Dockerfile.j2 | 2 +- .../docker-syncd-centec/supervisord.conf | 2 +- .../docker-syncd-centec-rpc/Dockerfile.j2 | 2 +- .../centec/docker-syncd-centec/Dockerfile.j2 | 2 +- .../docker-syncd-centec/supervisord.conf | 2 +- .../docker-syncd-invm-rpc/Dockerfile.j2 | 2 +- .../innovium/docker-syncd-invm/Dockerfile.j2 | 2 +- .../docker-syncd-invm/supervisord.conf | 2 +- .../docker-syncd-mrvl-rpc/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl/supervisord.conf | 2 +- .../docker-syncd-mrvl-rpc/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl/Dockerfile.j2 | 2 +- .../docker-syncd-mrvl/supervisord.conf | 2 +- .../docker-syncd-mrvl-rpc/Dockerfile.j2 | 2 +- .../marvell/docker-syncd-mrvl/Dockerfile.j2 | 3 +- .../docker-syncd-mrvl/supervisord.conf | 2 +- .../docker-saiserver-mlnx/Dockerfile.j2 | 2 +- .../docker-syncd-mlnx-rpc/Dockerfile.j2 | 2 +- .../mellanox/docker-syncd-mlnx/Dockerfile.j2 | 2 +- .../docker-syncd-mlnx/supervisord.conf | 2 +- .../docker-syncd-nephos-rpc/Dockerfile.j2 | 2 +- .../nephos/docker-syncd-nephos/Dockerfile.j2 | 2 +- .../docker-syncd-nephos/supervisord.conf | 2 +- platform/vs/docker-gbsyncd-vs/Dockerfile.j2 | 2 +- .../vs/docker-gbsyncd-vs/supervisord.conf | 2 +- platform/vs/docker-sonic-vs/Dockerfile.j2 | 2 +- platform/vs/docker-syncd-vs/Dockerfile.j2 | 2 +- platform/vs/docker-syncd-vs/supervisord.conf | 2 +- rules/docker-base-buster.mk | 1 - rules/docker-base-stretch.mk | 1 - rules/docker-base.mk | 1 - rules/supervisor.dep | 10 - rules/supervisor.mk | 9 - sonic-slave-buster/Dockerfile.j2 | 3 - sonic-slave-jessie/Dockerfile.j2 | 3 - sonic-slave-stretch/Dockerfile.j2 | 3 - .../py2/docker-dhcp-relay.supervisord.conf | 2 +- .../py3/docker-dhcp-relay.supervisord.conf | 2 +- src/supervisor/.gitignore | 4 - src/supervisor/Makefile | 33 -- ...e-hanging-and-crashes-if-system-cloc.patch | 304 ------------------ .../patch/0002-oserror-armhf-assert.patch | 16 - src/supervisor/patch/series | 2 - src/supervisor/patch/series-armhf | 2 - 94 files changed, 114 insertions(+), 497 deletions(-) delete mode 100644 rules/supervisor.dep delete mode 100644 rules/supervisor.mk delete mode 100644 src/supervisor/.gitignore delete mode 100644 src/supervisor/Makefile delete mode 100644 src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch delete mode 100644 src/supervisor/patch/0002-oserror-armhf-assert.patch delete mode 100644 src/supervisor/patch/series delete mode 100644 src/supervisor/patch/series-armhf diff --git a/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json b/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json index c6a21eb19f..101db0ffea 100644 --- a/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json +++ b/device/virtual/x86_64-kvm_x86_64-r0/pmon_daemon_control.json @@ -1,6 +1,7 @@ { "skip_ledd": true, "skip_xcvrd": true, + "skip_pcied": true, "skip_psud": true, "skip_syseepromd": true, "skip_thermalctld": true diff --git a/dockers/docker-base-buster/Dockerfile.j2 b/dockers/docker-base-buster/Dockerfile.j2 index f113750450..bf1d8197bf 100644 --- a/dockers/docker-base-buster/Dockerfile.j2 +++ b/dockers/docker-base-buster/Dockerfile.j2 @@ -50,9 +50,6 @@ RUN apt-get update && \ python3-pip \ rsyslog \ vim-tiny \ -# Install dependencies of supervisor - python-pkg-resources \ - python-meld3 \ # Install dependencies of redis-tools libatomic1 \ libjemalloc2 \ @@ -67,9 +64,6 @@ RUN apt-get update && \ # ip and ifconfig utility missing in docker for arm arch iproute2 \ net-tools \ -# for arm arch: Installing j2cli dependency package MarkupSafe from source relies on weeksetuptools and wheel - python-setuptools \ - python-wheel \ # for processing/handling json files in bash environment jq \ # for sairedis zmq rpc channel @@ -90,9 +84,22 @@ RUN dpkg -i redis-tools_6.0.6-1~bpo10+1_amd64.deb || apt-get install -f -y RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb {% endif %} +# Some Python packages require setuptools (or pkg_resources, which is supplied by setuptools) +# and some require wheel +RUN pip install setuptools==40.8.0 +RUN pip3 install setuptools==49.6.00 +RUN pip install wheel +RUN pip3 install wheel + # For templating RUN pip2 install j2cli +# Install supervisor +RUN pip3 install supervisor==4.2.1 + +# Add support for supervisord to handle startup dependencies +RUN pip3 install supervisord-dependent-startup==1.4.0 + RUN mkdir -p /etc/supervisor /var/log/supervisor RUN apt-get -y purge \ @@ -109,9 +116,6 @@ RUN apt-get -y purge \ {{ install_debian_packages(docker_base_buster_debs.split(' ')) }} {%- endif %} -# Add support for supervisord to handle startup dependencies -RUN pip2 install supervisord-dependent-startup==1.4.0 - # Clean up apt # Remove /var/lib/apt/lists/*, could be obsoleted for derived images RUN apt-get clean -y && \ diff --git a/dockers/docker-base-stretch/Dockerfile.j2 b/dockers/docker-base-stretch/Dockerfile.j2 index 2299b8bba6..aa6eda8a95 100644 --- a/dockers/docker-base-stretch/Dockerfile.j2 +++ b/dockers/docker-base-stretch/Dockerfile.j2 @@ -47,9 +47,8 @@ RUN apt-get update && \ python \ python-pip \ vim-tiny \ -# Install dependencies of supervisor - python-pkg-resources \ - python-meld3 \ +# Install redis-tools + redis-tools=5:5.0.3-3~bpo9+2 \ # common dependencies libpython2.7 \ libdaemon0 \ @@ -58,9 +57,6 @@ RUN apt-get update && \ # ip and ifconfig utility missing in docker for arm arch iproute2 \ net-tools \ -# for arm arch: Installing j2cli dependency package MarkupSafe from source relies on weeksetuptools and wheel - python-setuptools \ - python-wheel \ # for processing json files in bash environment jq \ # for sairedis zmq rpc channel @@ -85,9 +81,20 @@ RUN apt-get -y -t stretch-backports install rsyslog RUN rm redis-tools_6.0.6-1~bpo10+1_amd64.deb {% endif %} +# Some Python packages require setuptools (or pkg_resources, which is supplied by setuptools) +# and some require wheel +RUN pip install setuptools==40.8.0 +RUN pip install wheel + # For templating RUN pip install j2cli +# Install supervisor +RUN pip install supervisor>=3.4.0 + +# Add support for supervisord to handle startup dependencies +RUN pip install supervisord-dependent-startup==1.4.0 + RUN mkdir -p /etc/supervisor /var/log/supervisor RUN apt-get -y purge \ @@ -104,9 +111,6 @@ RUN apt-get -y purge \ {{ install_debian_packages(docker_base_stretch_debs.split(' ')) }} {%- endif %} -# Add support for supervisord to handle startup dependencies -RUN pip install supervisord-dependent-startup==1.4.0 - # Clean up apt # Remove /var/lib/apt/lists/*, could be obsoleted for derived images RUN apt-get clean -y && \ diff --git a/dockers/docker-base/Dockerfile.j2 b/dockers/docker-base/Dockerfile.j2 index e45235a1e1..591759bbca 100644 --- a/dockers/docker-base/Dockerfile.j2 +++ b/dockers/docker-base/Dockerfile.j2 @@ -44,6 +44,7 @@ RUN apt-get -y install \ vim-tiny \ perl \ python \ + python-pip \ rsyslog \ less @@ -51,8 +52,13 @@ COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"] COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"] COPY ["root/.vimrc", "/root/.vimrc"] -# Install dependencies of supervisor -RUN apt-get -y install python-pkg-resources python-meld3 +# Some Python packages require setuptools (or pkg_resources, which is supplied by setuptools) +# and some require wheel +RUN pip install setuptools==40.8.0 +RUN pip install wheel + +# Install supervisor +RUN pip install supervisor>=3.4.0 RUN mkdir -p /etc/supervisor RUN mkdir -p /var/log/supervisor diff --git a/dockers/docker-basic_router/Dockerfile b/dockers/docker-basic_router/Dockerfile index 7d7c724920..c5bccde72f 100644 --- a/dockers/docker-basic_router/Dockerfile +++ b/dockers/docker-basic_router/Dockerfile @@ -19,4 +19,4 @@ RUN mv /deps/basic_router /usr/sbin/basic_router COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-database/docker-database-init.sh b/dockers/docker-database/docker-database-init.sh index bc49376a0b..33f0f80a31 100755 --- a/dockers/docker-database/docker-database-init.sh +++ b/dockers/docker-database/docker-database-init.sh @@ -55,7 +55,7 @@ if [[ $DATABASE_TYPE == "chassisdb" ]]; then # generate all redis server supervisord configuration file sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf rm $db_cfg_file_tmp - exec /usr/bin/supervisord + exec supervisord exit 0 fi @@ -79,4 +79,4 @@ else fi rm $db_cfg_file_tmp -exec /usr/bin/supervisord +exec supervisord diff --git a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 index 9e8c553b65..1b5cadd00a 100644 --- a/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 +++ b/dockers/docker-dhcp-relay/docker-dhcp-relay.supervisord.conf.j2 @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-dhcp-relay/docker_init.sh b/dockers/docker-dhcp-relay/docker_init.sh index 9fc7a93e99..9bdc6399ca 100755 --- a/dockers/docker-dhcp-relay/docker_init.sh +++ b/dockers/docker-dhcp-relay/docker_init.sh @@ -21,4 +21,4 @@ chmod +x /usr/bin/wait_for_intf.sh # The docker container should start this script as PID 1, so now that supervisord is # properly configured, we exec supervisord so that it runs as PID 1 for the # duration of the container's lifetime -exec /usr/bin/supervisord +exec supervisord diff --git a/dockers/docker-fpm-frr/docker_init.sh b/dockers/docker-fpm-frr/docker_init.sh index 25482866b4..dadd832768 100755 --- a/dockers/docker-fpm-frr/docker_init.sh +++ b/dockers/docker-fpm-frr/docker_init.sh @@ -66,4 +66,4 @@ chmod 0755 /usr/sbin/bgp-unisolate mkdir -p /var/sonic echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status -exec /usr/bin/supervisord +exec supervisord diff --git a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 index 9c379404bc..205b57e5f6 100644 --- a/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 +++ b/dockers/docker-fpm-frr/frr/supervisord/supervisord.conf.j2 @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-fpm-gobgp/Dockerfile.j2 b/dockers/docker-fpm-gobgp/Dockerfile.j2 index b9b969edeb..cb0fd21b8f 100644 --- a/dockers/docker-fpm-gobgp/Dockerfile.j2 +++ b/dockers/docker-fpm-gobgp/Dockerfile.j2 @@ -27,4 +27,4 @@ COPY ["daemons", "/etc/quagga/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-fpm-quagga/Dockerfile.j2 b/dockers/docker-fpm-quagga/Dockerfile.j2 index 9d1312d073..fccc7f08df 100644 --- a/dockers/docker-fpm-quagga/Dockerfile.j2 +++ b/dockers/docker-fpm-quagga/Dockerfile.j2 @@ -36,4 +36,4 @@ COPY ["*.j2", "/usr/share/sonic/templates/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-iccpd/Dockerfile.j2 b/dockers/docker-iccpd/Dockerfile.j2 index 7c5c98ac72..f49bea7d84 100644 --- a/dockers/docker-iccpd/Dockerfile.j2 +++ b/dockers/docker-iccpd/Dockerfile.j2 @@ -31,4 +31,4 @@ RUN apt-get clean -y && \ apt-get autoremove -y && \ rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-iccpd/supervisord.conf b/dockers/docker-iccpd/supervisord.conf index 38d1ee56e6..716ca96b40 100644 --- a/dockers/docker-iccpd/supervisord.conf +++ b/dockers/docker-iccpd/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-lldp/docker-lldp-init.sh b/dockers/docker-lldp/docker-lldp-init.sh index ae507e8f50..eee07b4ada 100755 --- a/dockers/docker-lldp/docker-lldp-init.sh +++ b/dockers/docker-lldp/docker-lldp-init.sh @@ -2,4 +2,4 @@ #Generate supervisord.conf based on device metadata mkdir -p /etc/supervisor/conf.d/ sonic-cfggen -d -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf -exec /usr/bin/supervisord +exec supervisord diff --git a/dockers/docker-lldp/supervisord.conf.j2 b/dockers/docker-lldp/supervisord.conf.j2 index 5499e2af46..3abd847c4a 100644 --- a/dockers/docker-lldp/supervisord.conf.j2 +++ b/dockers/docker-lldp/supervisord.conf.j2 @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-nat/Dockerfile.j2 b/dockers/docker-nat/Dockerfile.j2 index 38930f7860..73b68dc70c 100644 --- a/dockers/docker-nat/Dockerfile.j2 +++ b/dockers/docker-nat/Dockerfile.j2 @@ -35,5 +35,4 @@ COPY ["critical_processes", "/etc/supervisor"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] - +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-nat/supervisord.conf b/dockers/docker-nat/supervisord.conf index 9840300ec1..8555f2a48a 100644 --- a/dockers/docker-nat/supervisord.conf +++ b/dockers/docker-nat/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-orchagent/docker-init.sh b/dockers/docker-orchagent/docker-init.sh index 41d815b4d7..b15c7cc3c9 100755 --- a/dockers/docker-orchagent/docker-init.sh +++ b/dockers/docker-orchagent/docker-init.sh @@ -25,4 +25,4 @@ if [ "$VLAN" != "" ]; then cp /usr/share/sonic/templates/ndppd.conf /etc/supervisor/conf.d/ fi -exec /usr/bin/supervisord +exec supervisord diff --git a/dockers/docker-orchagent/supervisord.conf b/dockers/docker-orchagent/supervisord.conf index 780a4d7904..8ec2b6354a 100644 --- a/dockers/docker-orchagent/supervisord.conf +++ b/dockers/docker-orchagent/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 index c44bbbbf8e..9ce4d4ca6d 100644 --- a/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 +++ b/dockers/docker-platform-monitor/docker-pmon.supervisord.conf.j2 @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-platform-monitor/docker_init.sh b/dockers/docker-platform-monitor/docker_init.sh index 2a821153aa..0039eb34d8 100755 --- a/dockers/docker-platform-monitor/docker_init.sh +++ b/dockers/docker-platform-monitor/docker_init.sh @@ -40,4 +40,4 @@ if [ $HAVE_FANCONTROL_CONF -eq 1 ]; then /bin/cp -f $FANCONTROL_CONF_FILE /etc/ fi -exec /usr/bin/supervisord +exec supervisord diff --git a/dockers/docker-router-advertiser/docker-init.sh b/dockers/docker-router-advertiser/docker-init.sh index a3f373f438..28ffcb094c 100755 --- a/dockers/docker-router-advertiser/docker-init.sh +++ b/dockers/docker-router-advertiser/docker-init.sh @@ -14,4 +14,4 @@ sonic-cfggen $CFGGEN_PARAMS chmod +x /usr/bin/wait_for_link.sh -exec /usr/bin/supervisord +exec supervisord diff --git a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 index 5a6416b0ff..ae73cd6e98 100644 --- a/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 +++ b/dockers/docker-router-advertiser/docker-router-advertiser.supervisord.conf.j2 @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-sflow/Dockerfile.j2 b/dockers/docker-sflow/Dockerfile.j2 index e1d7ce7285..db2d4b3bc0 100644 --- a/dockers/docker-sflow/Dockerfile.j2 +++ b/dockers/docker-sflow/Dockerfile.j2 @@ -32,4 +32,4 @@ COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] COPY ["port_index_mapper.py", "/usr/bin"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-sflow/supervisord.conf b/dockers/docker-sflow/supervisord.conf index 2731d89d06..8d1bdc5059 100644 --- a/dockers/docker-sflow/supervisord.conf +++ b/dockers/docker-sflow/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-snmp/Dockerfile.j2 b/dockers/docker-snmp/Dockerfile.j2 index 213d941c58..c98b955bf0 100644 --- a/dockers/docker-snmp/Dockerfile.j2 +++ b/dockers/docker-snmp/Dockerfile.j2 @@ -76,4 +76,4 @@ COPY ["critical_processes", "/etc/supervisor"] # Although exposing ports is not needed for host net mode, keep it for possible bridge mode EXPOSE 161/udp 162/udp -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-snmp/supervisord.conf b/dockers/docker-snmp/supervisord.conf index 05f54122b5..d1e6d09a82 100644 --- a/dockers/docker-snmp/supervisord.conf +++ b/dockers/docker-snmp/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 index 24ae3643b3..235d1a8e76 100644 --- a/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 +++ b/dockers/docker-sonic-mgmt-framework/Dockerfile.j2 @@ -36,4 +36,4 @@ RUN apt-get remove -y g++ python-dev RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-sonic-mgmt-framework/supervisord.conf b/dockers/docker-sonic-mgmt-framework/supervisord.conf index 5ff38f0f62..f3060fb95d 100644 --- a/dockers/docker-sonic-mgmt-framework/supervisord.conf +++ b/dockers/docker-sonic-mgmt-framework/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-sonic-restapi/Dockerfile.j2 b/dockers/docker-sonic-restapi/Dockerfile.j2 index 32904531f1..5463f0b44b 100644 --- a/dockers/docker-sonic-restapi/Dockerfile.j2 +++ b/dockers/docker-sonic-restapi/Dockerfile.j2 @@ -25,4 +25,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-sonic-restapi/supervisord.conf b/dockers/docker-sonic-restapi/supervisord.conf index ac9a9fe18a..74bbc92415 100644 --- a/dockers/docker-sonic-restapi/supervisord.conf +++ b/dockers/docker-sonic-restapi/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-sonic-telemetry/Dockerfile.j2 b/dockers/docker-sonic-telemetry/Dockerfile.j2 index 90bb1d5741..6670e75625 100644 --- a/dockers/docker-sonic-telemetry/Dockerfile.j2 +++ b/dockers/docker-sonic-telemetry/Dockerfile.j2 @@ -28,4 +28,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-sonic-telemetry/supervisord.conf b/dockers/docker-sonic-telemetry/supervisord.conf index f0578803a2..df1e6fa5a3 100644 --- a/dockers/docker-sonic-telemetry/supervisord.conf +++ b/dockers/docker-sonic-telemetry/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/dockers/docker-teamd/Dockerfile.j2 b/dockers/docker-teamd/Dockerfile.j2 index d9795f20f5..26250830b6 100644 --- a/dockers/docker-teamd/Dockerfile.j2 +++ b/dockers/docker-teamd/Dockerfile.j2 @@ -27,4 +27,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/dockers/docker-teamd/supervisord.conf b/dockers/docker-teamd/supervisord.conf index c152932608..78549a7684 100644 --- a/dockers/docker-teamd/supervisord.conf +++ b/dockers/docker-teamd/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/files/scripts/supervisor-proc-exit-listener b/files/scripts/supervisor-proc-exit-listener index e81e6b31a8..7fceaf74ee 100755 --- a/files/scripts/supervisor-proc-exit-listener +++ b/files/scripts/supervisor-proc-exit-listener @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import getopt import os @@ -7,7 +7,6 @@ import sys import syslog import swsssdk - from supervisor import childutils # Each line of this file should specify either one critical process or one @@ -27,7 +26,7 @@ def get_critical_group_and_process_list(): critical_process_list = [] with open(CRITICAL_PROCESSES_FILE, 'r') as file: - for line in file: + for line in file: line_info = line.strip(' \n').split(':') if len(line_info) != 2: syslog.syslog(syslog.LOG_ERR, "Syntax of the line {} in critical_processes file is incorrect. Exiting...".format(line)) @@ -86,7 +85,7 @@ def main(argv): syslog.syslog(syslog.LOG_ERR, "Unable to retrieve features table from Config DB. Exiting...") sys.exit(2) - if not features_table.has_key(container_name): + if container_name not in features_table: syslog.syslog(syslog.LOG_ERR, "Unable to retrieve feature '{}'. Exiting...".format(container_name)) sys.exit(3) diff --git a/platform/barefoot/docker-saiserver-bfn/Dockerfile b/platform/barefoot/docker-saiserver-bfn/Dockerfile index 427a551e00..3f8071234b 100755 --- a/platform/barefoot/docker-saiserver-bfn/Dockerfile +++ b/platform/barefoot/docker-saiserver-bfn/Dockerfile @@ -34,5 +34,4 @@ COPY ["profile.ini", "portmap.ini", "/etc/sai/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /deps -ENTRYPOINT ["/usr/bin/supervisord"] - +ENTRYPOINT ["supervisord"] diff --git a/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 index f10eb7fb52..9b547dbcac 100644 --- a/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn-rpc/Dockerfile.j2 @@ -49,5 +49,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] - +ENTRYPOINT ["supervisord"] diff --git a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 index c12c36b126..712b15826c 100755 --- a/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 +++ b/platform/barefoot/docker-syncd-bfn/Dockerfile.j2 @@ -36,5 +36,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] - +ENTRYPOINT ["supervisord"] diff --git a/platform/barefoot/docker-syncd-bfn/supervisord.conf b/platform/barefoot/docker-syncd-bfn/supervisord.conf index 7137279103..39ea308277 100644 --- a/platform/barefoot/docker-syncd-bfn/supervisord.conf +++ b/platform/barefoot/docker-syncd-bfn/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 index 79dccf8f37..4294b79ff0 100644 --- a/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-saiserver-brcm/Dockerfile.j2 @@ -33,4 +33,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 index 5b4f71144c..38dbf15b12 100644 --- a/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm-rpc/Dockerfile.j2 @@ -48,4 +48,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 index ae517eac08..9c68eda56c 100755 --- a/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 +++ b/platform/broadcom/docker-syncd-brcm/Dockerfile.j2 @@ -32,4 +32,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/broadcom/docker-syncd-brcm/supervisord.conf b/platform/broadcom/docker-syncd-brcm/supervisord.conf index 77f6519c2e..a8e594c47a 100644 --- a/platform/broadcom/docker-syncd-brcm/supervisord.conf +++ b/platform/broadcom/docker-syncd-brcm/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/cavium/docker-saiserver-cavm/Dockerfile b/platform/cavium/docker-saiserver-cavm/Dockerfile index 2f667c8038..c73abb0e4b 100644 --- a/platform/cavium/docker-saiserver-cavm/Dockerfile +++ b/platform/cavium/docker-saiserver-cavm/Dockerfile @@ -27,4 +27,4 @@ COPY ["portmap.ini", "profile.ini", "/etc/sai/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf deps -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 index 9848554348..2e1665d260 100644 --- a/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm-rpc/Dockerfile.j2 @@ -48,4 +48,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 index 0e2bc4b6bb..cdbd3d15df 100755 --- a/platform/cavium/docker-syncd-cavm/Dockerfile.j2 +++ b/platform/cavium/docker-syncd-cavm/Dockerfile.j2 @@ -32,4 +32,4 @@ COPY ["profile.ini", "/etc/ssw/AS7512/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 index 2174fd91f9..0802f3532c 100755 --- a/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec-rpc/Dockerfile.j2 @@ -48,4 +48,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 index f105b12212..7cb629f6ec 100755 --- a/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec-arm64/docker-syncd-centec/Dockerfile.j2 @@ -34,4 +34,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/centec-arm64/docker-syncd-centec/supervisord.conf b/platform/centec-arm64/docker-syncd-centec/supervisord.conf index 1a15c140a7..111145021d 100755 --- a/platform/centec-arm64/docker-syncd-centec/supervisord.conf +++ b/platform/centec-arm64/docker-syncd-centec/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 index 2174fd91f9..0802f3532c 100644 --- a/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec-rpc/Dockerfile.j2 @@ -48,4 +48,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/centec/docker-syncd-centec/Dockerfile.j2 b/platform/centec/docker-syncd-centec/Dockerfile.j2 index f6c875bab1..dfd19af47c 100755 --- a/platform/centec/docker-syncd-centec/Dockerfile.j2 +++ b/platform/centec/docker-syncd-centec/Dockerfile.j2 @@ -30,4 +30,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/centec/docker-syncd-centec/supervisord.conf b/platform/centec/docker-syncd-centec/supervisord.conf index dc6977ed47..d5501500ba 100644 --- a/platform/centec/docker-syncd-centec/supervisord.conf +++ b/platform/centec/docker-syncd-centec/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 index af31d587b9..8b6d6ae6ab 100755 --- a/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm-rpc/Dockerfile.j2 @@ -50,4 +50,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/innovium/docker-syncd-invm/Dockerfile.j2 b/platform/innovium/docker-syncd-invm/Dockerfile.j2 index 27054e23e4..0d6b1e8f48 100755 --- a/platform/innovium/docker-syncd-invm/Dockerfile.j2 +++ b/platform/innovium/docker-syncd-invm/Dockerfile.j2 @@ -30,4 +30,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/innovium/docker-syncd-invm/supervisord.conf b/platform/innovium/docker-syncd-invm/supervisord.conf index 2a2413b300..b0890868b5 100755 --- a/platform/innovium/docker-syncd-invm/supervisord.conf +++ b/platform/innovium/docker-syncd-invm/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/marvell-arm64/docker-syncd-mrvl-rpc/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl-rpc/Dockerfile.j2 index cea067d2ab..121166a805 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl-rpc/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl-rpc/Dockerfile.j2 @@ -48,4 +48,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 index 5f5097f4b4..a9898e2f9f 100755 --- a/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-arm64/docker-syncd-mrvl/Dockerfile.j2 @@ -34,4 +34,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/marvell-arm64/docker-syncd-mrvl/supervisord.conf b/platform/marvell-arm64/docker-syncd-mrvl/supervisord.conf index 1a15c140a7..111145021d 100644 --- a/platform/marvell-arm64/docker-syncd-mrvl/supervisord.conf +++ b/platform/marvell-arm64/docker-syncd-mrvl/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 index cea067d2ab..121166a805 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl-rpc/Dockerfile.j2 @@ -48,4 +48,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 index 5f5097f4b4..a9898e2f9f 100755 --- a/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell-armhf/docker-syncd-mrvl/Dockerfile.j2 @@ -34,4 +34,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/marvell-armhf/docker-syncd-mrvl/supervisord.conf b/platform/marvell-armhf/docker-syncd-mrvl/supervisord.conf index 408899f888..9bf6ab7949 100644 --- a/platform/marvell-armhf/docker-syncd-mrvl/supervisord.conf +++ b/platform/marvell-armhf/docker-syncd-mrvl/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 index cea067d2ab..121166a805 100644 --- a/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl-rpc/Dockerfile.j2 @@ -48,4 +48,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 index 5679fb38e3..b156095a17 100755 --- a/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 +++ b/platform/marvell/docker-syncd-mrvl/Dockerfile.j2 @@ -30,5 +30,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] - +ENTRYPOINT ["supervisord"] diff --git a/platform/marvell/docker-syncd-mrvl/supervisord.conf b/platform/marvell/docker-syncd-mrvl/supervisord.conf index 73523ac02a..c5aed305bf 100644 --- a/platform/marvell/docker-syncd-mrvl/supervisord.conf +++ b/platform/marvell/docker-syncd-mrvl/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 index b202be5b34..5d901f4ed9 100644 --- a/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-saiserver-mlnx/Dockerfile.j2 @@ -44,4 +44,4 @@ COPY ["sai_2700.xml", "/usr/share/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 index 3f6225c96b..5119f7c412 100644 --- a/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx-rpc/Dockerfile.j2 @@ -62,4 +62,4 @@ RUN apt-get clean -y && \ apt-get autoremove -y && \ rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 index 21aaef2f30..7fba066430 100755 --- a/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 +++ b/platform/mellanox/docker-syncd-mlnx/Dockerfile.j2 @@ -39,4 +39,4 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] COPY ["files/supervisor-proc-exit-listener", "/usr/bin"] COPY ["critical_processes", "/etc/supervisor/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/mellanox/docker-syncd-mlnx/supervisord.conf b/platform/mellanox/docker-syncd-mlnx/supervisord.conf index 55578ff2dc..9311a255b0 100644 --- a/platform/mellanox/docker-syncd-mlnx/supervisord.conf +++ b/platform/mellanox/docker-syncd-mlnx/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 index b4b4724e47..4f27ba6bce 100644 --- a/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos-rpc/Dockerfile.j2 @@ -48,4 +48,4 @@ RUN apt-get update \ COPY ["ptf_nn_agent.conf", "/etc/supervisor/conf.d/"] -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 index 967dad3169..6c3c42ac43 100755 --- a/platform/nephos/docker-syncd-nephos/Dockerfile.j2 +++ b/platform/nephos/docker-syncd-nephos/Dockerfile.j2 @@ -43,4 +43,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/nephos/docker-syncd-nephos/supervisord.conf b/platform/nephos/docker-syncd-nephos/supervisord.conf index 55578ff2dc..9311a255b0 100644 --- a/platform/nephos/docker-syncd-nephos/supervisord.conf +++ b/platform/nephos/docker-syncd-nephos/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 index 316466dfb4..60bd79b2ee 100644 --- a/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-gbsyncd-vs/Dockerfile.j2 @@ -31,4 +31,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/vs/docker-gbsyncd-vs/supervisord.conf b/platform/vs/docker-gbsyncd-vs/supervisord.conf index 6ba7ecbbdd..3583ef6b5a 100644 --- a/platform/vs/docker-gbsyncd-vs/supervisord.conf +++ b/platform/vs/docker-gbsyncd-vs/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/platform/vs/docker-sonic-vs/Dockerfile.j2 b/platform/vs/docker-sonic-vs/Dockerfile.j2 index 5f5f91d5a0..b619812461 100644 --- a/platform/vs/docker-sonic-vs/Dockerfile.j2 +++ b/platform/vs/docker-sonic-vs/Dockerfile.j2 @@ -170,4 +170,4 @@ RUN mkdir -p /var/warmboot/teamd ENV PLATFORM=x86_64-kvm_x86_64-r0 ENV HWSKU=Force10-S6000 -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/vs/docker-syncd-vs/Dockerfile.j2 b/platform/vs/docker-syncd-vs/Dockerfile.j2 index fea26b2f10..5e3d992b56 100644 --- a/platform/vs/docker-syncd-vs/Dockerfile.j2 +++ b/platform/vs/docker-syncd-vs/Dockerfile.j2 @@ -31,4 +31,4 @@ COPY ["critical_processes", "/etc/supervisor/"] RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y RUN rm -rf /debs -ENTRYPOINT ["/usr/bin/supervisord"] +ENTRYPOINT ["supervisord"] diff --git a/platform/vs/docker-syncd-vs/supervisord.conf b/platform/vs/docker-syncd-vs/supervisord.conf index 36e33850cb..7416f23a45 100644 --- a/platform/vs/docker-syncd-vs/supervisord.conf +++ b/platform/vs/docker-syncd-vs/supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/rules/docker-base-buster.mk b/rules/docker-base-buster.mk index 61ba96eda5..86bfc57814 100644 --- a/rules/docker-base-buster.mk +++ b/rules/docker-base-buster.mk @@ -3,7 +3,6 @@ DOCKER_BASE_BUSTER = docker-base-buster.gz $(DOCKER_BASE_BUSTER)_PATH = $(DOCKERS_PATH)/docker-base-buster -$(DOCKER_BASE_BUSTER)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE_BUSTER)_DEPENDS += $(SOCAT) GDB = gdb diff --git a/rules/docker-base-stretch.mk b/rules/docker-base-stretch.mk index 55b7fd9f86..de10f80828 100644 --- a/rules/docker-base-stretch.mk +++ b/rules/docker-base-stretch.mk @@ -2,7 +2,6 @@ DOCKER_BASE_STRETCH = docker-base-stretch.gz $(DOCKER_BASE_STRETCH)_PATH = $(DOCKERS_PATH)/docker-base-stretch -$(DOCKER_BASE_STRETCH)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE_STRETCH)_DEPENDS += $(SOCAT) GDB = gdb diff --git a/rules/docker-base.mk b/rules/docker-base.mk index 2d0653fc8f..3b2ede987a 100644 --- a/rules/docker-base.mk +++ b/rules/docker-base.mk @@ -2,7 +2,6 @@ DOCKER_BASE = docker-base.gz $(DOCKER_BASE)_PATH = $(DOCKERS_PATH)/docker-base -$(DOCKER_BASE)_DEPENDS += $(SUPERVISOR) $(DOCKER_BASE)_DEPENDS += $(BASH) $(DOCKER_BASE)_DEPENDS += $(SOCAT) diff --git a/rules/supervisor.dep b/rules/supervisor.dep deleted file mode 100644 index 7d7bcf36e9..0000000000 --- a/rules/supervisor.dep +++ /dev/null @@ -1,10 +0,0 @@ - -SPATH := $($(SUPERVISOR)_SRC_PATH) -DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/supervisor.mk rules/supervisor.dep -DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) -DEP_FILES += $(shell git ls-files $(SPATH)) - -$(SUPERVISOR)_CACHE_MODE := GIT_CONTENT_SHA -$(SUPERVISOR)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) -$(SUPERVISOR)_DEP_FILES := $(DEP_FILES) - diff --git a/rules/supervisor.mk b/rules/supervisor.mk deleted file mode 100644 index cd97eabf80..0000000000 --- a/rules/supervisor.mk +++ /dev/null @@ -1,9 +0,0 @@ -# supervisor package - -SUPERVISOR_VERSION = 3.3.3 - -export SUPERVISOR_VERSION - -SUPERVISOR = python-supervisor_$(SUPERVISOR_VERSION)-1_all.deb -$(SUPERVISOR)_SRC_PATH = $(SRC_PATH)/supervisor -SONIC_MAKE_DEBS += $(SUPERVISOR) diff --git a/sonic-slave-buster/Dockerfile.j2 b/sonic-slave-buster/Dockerfile.j2 index 101008fa4a..b58027bf30 100644 --- a/sonic-slave-buster/Dockerfile.j2 +++ b/sonic-slave-buster/Dockerfile.j2 @@ -382,9 +382,6 @@ RUN pip3 install "lxml==4.6.1" # For sonic-platform-common testing RUN pip3 install redis -# For supervisor build -RUN apt-get install python-meld3 - # For vs image build RUN pip2 install pexpect==4.6.0 RUN pip3 install pexpect==4.8.0 diff --git a/sonic-slave-jessie/Dockerfile.j2 b/sonic-slave-jessie/Dockerfile.j2 index 32db448de2..ae5bd2b14f 100644 --- a/sonic-slave-jessie/Dockerfile.j2 +++ b/sonic-slave-jessie/Dockerfile.j2 @@ -300,9 +300,6 @@ RUN pip install --force-reinstall --upgrade "jinja2>=2.10" # For templating (requiring jinja2) RUN pip install j2cli==0.3.10 -# For supervisor build -RUN pip install meld3 mock - # For vs image build RUN pip install pexpect==4.6.0 diff --git a/sonic-slave-stretch/Dockerfile.j2 b/sonic-slave-stretch/Dockerfile.j2 index 84d87e5973..59a7044f38 100644 --- a/sonic-slave-stretch/Dockerfile.j2 +++ b/sonic-slave-stretch/Dockerfile.j2 @@ -365,9 +365,6 @@ RUN pip3 install "lxml==4.6.1" # For sonic-platform-common testing RUN pip3 install redis -# For supervisor build -RUN pip2 install meld3 mock - # For vs image build RUN pip2 install pexpect==4.6.0 diff --git a/src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf index be52694b78..a213a25178 100644 --- a/src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/py2/docker-dhcp-relay.supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/src/sonic-config-engine/tests/sample_output/py3/docker-dhcp-relay.supervisord.conf b/src/sonic-config-engine/tests/sample_output/py3/docker-dhcp-relay.supervisord.conf index 3e485f4ddc..d5338b18cf 100644 --- a/src/sonic-config-engine/tests/sample_output/py3/docker-dhcp-relay.supervisord.conf +++ b/src/sonic-config-engine/tests/sample_output/py3/docker-dhcp-relay.supervisord.conf @@ -4,7 +4,7 @@ logfile_backups=2 nodaemon=true [eventlistener:dependent-startup] -command=python -m supervisord_dependent_startup +command=python3 -m supervisord_dependent_startup autostart=true autorestart=unexpected startretries=0 diff --git a/src/supervisor/.gitignore b/src/supervisor/.gitignore deleted file mode 100644 index d19db76ab9..0000000000 --- a/src/supervisor/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!.gitignore -!Makefile -!patch/ diff --git a/src/supervisor/Makefile b/src/supervisor/Makefile deleted file mode 100644 index 2bd2724a39..0000000000 --- a/src/supervisor/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -.ONESHELL: -SHELL = /bin/bash -.SHELLFLAGS += -e - -MAIN_TARGET = python-supervisor_$(SUPERVISOR_VERSION)-1_all.deb - -$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% : - # Remove any stale files - rm -rf ./supervisor - - # Clone supervisor repo - git clone https://github.com/Supervisor/supervisor.git - pushd ./supervisor - - # Reset HEAD to the commit of the proper tag - # NOTE: Using "git checkout " here detaches our HEAD, - # which stg doesn't like, so we use this method instead - git reset --hard $(SUPERVISOR_VERSION) - - # Apply patches - stg init - stg import -s ../patch/series - -ifneq (,$(filter $(CONFIGURED_ARCH), armhf arm64)) - stg import -s ../patch/series-armhf -endif - - # Build Python and Debian package - python setup.py --command-packages=stdeb.command bdist_deb - popd - - # Move the newly-built .deb packages to the destination directory - mv ./supervisor/deb_dist/$* $(DEST)/ diff --git a/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch b/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch deleted file mode 100644 index 6c4a6b7c2a..0000000000 --- a/src/supervisor/patch/0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch +++ /dev/null @@ -1,304 +0,0 @@ -From 5b56519e68e866662d9fd9a6681b6b47d6b5fcdb Mon Sep 17 00:00:00 2001 -From: Joe LeVeque -Date: Thu, 28 Feb 2019 01:43:54 +0000 -Subject: [PATCH] Prevent excessive hanging and crashes if system clock rolls - backward - ---- - supervisor/process.py | 36 ++++++ - supervisor/tests/test_process.py | 183 +++++++++++++++++++++++++++++++ - 2 files changed, 219 insertions(+) - -diff --git a/supervisor/process.py b/supervisor/process.py -index f9ddcd9..5f73e6b 100644 ---- a/supervisor/process.py -+++ b/supervisor/process.py -@@ -347,6 +347,28 @@ class Subprocess: - options.write(2, "supervisor: child process was not spawned\n") - options._exit(127) # exit process with code for spawn failure - -+ def _check_and_adjust_for_system_clock_rollback(self, test_time): -+ """ -+ Check if system clock has rolled backward beyond test_time. If so, set -+ affected timestamps to test_time. -+ """ -+ if self.state == ProcessStates.STARTING: -+ if test_time < self.laststart: -+ self.laststart = test_time; -+ if self.delay > 0 and test_time < (self.delay - self.config.startsecs): -+ self.delay = test_time + self.config.startsecs -+ elif self.state == ProcessStates.RUNNING: -+ if test_time > self.laststart and test_time < (self.laststart + self.config.startsecs): -+ self.laststart = test_time - self.config.startsecs -+ elif self.state == ProcessStates.STOPPING: -+ if test_time < self.laststopreport: -+ self.laststopreport = test_time; -+ if self.delay > 0 and test_time < (self.delay - self.config.stopwaitsecs): -+ self.delay = test_time + self.config.stopwaitsecs -+ elif self.state == ProcessStates.BACKOFF: -+ if self.delay > 0 and test_time < (self.delay - self.backoff): -+ self.delay = test_time + self.backoff -+ - def stop(self): - """ Administrative stop """ - self.administrative_stop = True -@@ -357,6 +379,9 @@ class Subprocess: - """ Log a 'waiting for x to stop' message with throttling. """ - if self.state == ProcessStates.STOPPING: - now = time.time() -+ -+ self._check_and_adjust_for_system_clock_rollback(now) -+ - if now > (self.laststopreport + 2): # every 2 seconds - self.config.options.logger.info( - 'waiting for %s to stop' % self.config.name) -@@ -487,6 +512,9 @@ class Subprocess: - es, msg = decode_wait_status(sts) - - now = time.time() -+ -+ self._check_and_adjust_for_system_clock_rollback(now) -+ - self.laststop = now - processname = self.config.name - -@@ -586,6 +614,8 @@ class Subprocess: - now = time.time() - state = self.state - -+ self._check_and_adjust_for_system_clock_rollback(now) -+ - logger = self.config.options.logger - - if self.config.options.mood > SupervisorStates.RESTARTING: -@@ -805,6 +835,12 @@ class EventListenerPool(ProcessGroupBase): - if dispatch_capable: - if self.dispatch_throttle: - now = time.time() -+ -+ if now < self.last_dispatch: -+ # The system clock appears to have moved backward -+ # Reset self.last_dispatch accordingly -+ self.last_dispatch = now; -+ - if now - self.last_dispatch < self.dispatch_throttle: - return - self.dispatch() -diff --git a/supervisor/tests/test_process.py b/supervisor/tests/test_process.py -index 7f9bab2..6808f60 100644 ---- a/supervisor/tests/test_process.py -+++ b/supervisor/tests/test_process.py -@@ -736,6 +736,40 @@ class SubprocessTests(unittest.TestCase): - instance.stop_report() - self.assertEqual(len(options.logger.data), 1) # throttled - -+ def test_stop_report_laststopreport_in_future(self): -+ future_time = time.time() + 3600 # 1 hour into the future -+ options = DummyOptions() -+ config = DummyPConfig(options, 'test', '/test') -+ instance = self._makeOne(config) -+ instance.pid = 11 -+ dispatcher = DummyDispatcher(writable=True) -+ instance.dispatchers = {'foo':dispatcher} -+ from supervisor.states import ProcessStates -+ instance.state = ProcessStates.STOPPING -+ instance.laststopreport = future_time -+ -+ # This iteration of stop_report() should reset instance.laststopreport -+ # to the current time -+ instance.stop_report() -+ -+ # No logging should have taken place -+ self.assertEqual(len(options.logger.data), 0) -+ -+ # Ensure instance.laststopreport has rolled backward -+ self.assertTrue(instance.laststopreport < future_time) -+ -+ # Sleep for 2 seconds -+ time.sleep(2) -+ -+ # This iteration of stop_report() should actaully trigger the report -+ instance.stop_report() -+ -+ self.assertEqual(len(options.logger.data), 1) -+ self.assertEqual(options.logger.data[0], 'waiting for test to stop') -+ self.assertNotEqual(instance.laststopreport, 0) -+ instance.stop_report() -+ self.assertEqual(len(options.logger.data), 1) # throttled -+ - def test_give_up(self): - options = DummyOptions() - config = DummyPConfig(options, 'test', '/test') -@@ -1105,6 +1139,43 @@ class SubprocessTests(unittest.TestCase): - self.assertEqual(event.__class__, events.ProcessStateBackoffEvent) - self.assertEqual(event.from_state, ProcessStates.STARTING) - -+ # This tests the case where the process has stayed alive longer than -+ # startsecs (i.e., long enough to enter the RUNNING state), however the -+ # system clock has since rolled backward such that the current time is -+ # greater than laststart but less than startsecs. -+ def test_finish_running_state_exited_too_quickly_due_to_clock_rollback(self): -+ options = DummyOptions() -+ config = DummyPConfig(options, 'notthere', '/notthere', -+ stdout_logfile='/tmp/foo', startsecs=10) -+ instance = self._makeOne(config) -+ instance.config.options.pidhistory[123] = instance -+ pipes = {'stdout':'','stderr':''} -+ instance.pipes = pipes -+ instance.config.exitcodes =[-1] -+ instance.laststart = time.time() -+ from supervisor.states import ProcessStates -+ from supervisor import events -+ instance.state = ProcessStates.RUNNING -+ L = [] -+ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) -+ instance.pid = 123 -+ instance.finish(123, 1) -+ self.assertFalse(instance.killing) -+ self.assertEqual(instance.pid, 0) -+ self.assertEqual(options.parent_pipes_closed, pipes) -+ self.assertEqual(instance.pipes, {}) -+ self.assertEqual(instance.dispatchers, {}) -+ self.assertEqual(options.logger.data[0], -+ 'exited: notthere (terminated by SIGHUP; expected)') -+ self.assertEqual(instance.exitstatus, -1) -+ self.assertEqual(len(L), 1) -+ event = L[0] -+ self.assertEqual(event.__class__, -+ events.ProcessStateExitedEvent) -+ self.assertEqual(event.expected, True) -+ self.assertEqual(event.extra_values, [('expected', True), ('pid', 123)]) -+ self.assertEqual(event.from_state, ProcessStates.RUNNING) -+ - def test_finish_running_state_laststart_in_future(self): - options = DummyOptions() - config = DummyPConfig(options, 'notthere', '/notthere', -@@ -1402,6 +1473,92 @@ class SubprocessTests(unittest.TestCase): - event = L[0] - self.assertEqual(event.__class__, events.ProcessStateRunningEvent) - -+ def test_transition_starting_to_running_laststart_in_future(self): -+ from supervisor import events -+ L = [] -+ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) -+ from supervisor.states import ProcessStates -+ -+ future_time = time.time() + 3600 # 1 hour into the future -+ options = DummyOptions() -+ test_startsecs = 2 -+ -+ # this should go from STARTING to RUNNING via transition() -+ pconfig = DummyPConfig(options, 'process', 'process','/bin/process', -+ startsecs=test_startsecs) -+ process = self._makeOne(pconfig) -+ process.backoff = 1 -+ process.delay = 1 -+ process.system_stop = False -+ process.laststart = future_time -+ process.pid = 1 -+ process.stdout_buffer = 'abc' -+ process.stderr_buffer = 'def' -+ process.state = ProcessStates.STARTING -+ -+ # This iteration of transition() should reset process.laststart -+ # to the current time -+ process.transition() -+ -+ # Process state should still be STARTING -+ self.assertEqual(process.state, ProcessStates.STARTING) -+ -+ # Ensure process.laststart has rolled backward -+ self.assertTrue(process.laststart < future_time) -+ -+ # Sleep for (startsecs + 1) -+ time.sleep(test_startsecs + 1) -+ -+ # This iteration of transition() should actaully trigger the state -+ # transition to RUNNING -+ process.transition() -+ -+ # this implies RUNNING -+ self.assertEqual(process.backoff, 0) -+ self.assertEqual(process.delay, 0) -+ self.assertFalse(process.system_stop) -+ self.assertEqual(process.state, ProcessStates.RUNNING) -+ self.assertEqual(options.logger.data[0], -+ 'success: process entered RUNNING state, process has ' -+ 'stayed up for > than {} seconds (startsecs)'.format(test_startsecs)) -+ self.assertEqual(len(L), 1) -+ event = L[0] -+ self.assertEqual(event.__class__, events.ProcessStateRunningEvent) -+ -+ def test_transition_backoff_to_starting_delay_in_future(self): -+ from supervisor import events -+ L = [] -+ events.subscribe(events.ProcessStateEvent, lambda x: L.append(x)) -+ from supervisor.states import ProcessStates, SupervisorStates -+ -+ future_time = time.time() + 3600 # 1 hour into the future -+ options = DummyOptions() -+ -+ pconfig = DummyPConfig(options, 'process', 'process','/bin/process') -+ process = self._makeOne(pconfig) -+ process.laststart = 1 -+ process.delay = future_time -+ process.backoff = 0 -+ process.state = ProcessStates.BACKOFF -+ -+ # This iteration of transition() should reset process.delay -+ # to the current time -+ process.transition() -+ -+ # Process state should still be BACKOFF -+ self.assertEqual(process.state, ProcessStates.BACKOFF) -+ -+ # Ensure process.delay has rolled backward -+ self.assertTrue(process.delay < future_time) -+ -+ # This iteration of transition() should actaully trigger the state -+ # transition to STARTING -+ process.transition() -+ -+ self.assertEqual(process.state, ProcessStates.STARTING) -+ self.assertEqual(len(L), 1) -+ self.assertEqual(L[0].__class__, events.ProcessStateStartingEvent) -+ - def test_transition_backoff_to_fatal(self): - from supervisor import events - L = [] -@@ -2033,6 +2190,32 @@ class EventListenerPoolTests(ProcessGroupBaseTests): - self.assertEqual(process1.listener_state, EventListenerStates.BUSY) - self.assertEqual(process1.event, event) - -+ def test_transition_event_proc_running_with_dispatch_throttle_last_dispatch_in_future(self): -+ future_time = time.time() + 3600 # 1 hour into the future -+ options = DummyOptions() -+ from supervisor.states import ProcessStates -+ pconfig1 = DummyPConfig(options, 'process1', 'process1','/bin/process1') -+ process1 = DummyProcess(pconfig1, state=ProcessStates.RUNNING) -+ gconfig = DummyPGroupConfig(options, pconfigs=[pconfig1]) -+ pool = self._makeOne(gconfig) -+ pool.dispatch_throttle = 5 -+ pool.last_dispatch = future_time -+ pool.processes = {'process1': process1} -+ event = DummyEvent() -+ from supervisor.states import EventListenerStates -+ process1.listener_state = EventListenerStates.READY -+ class DummyGroup: -+ config = gconfig -+ process1.group = DummyGroup -+ pool._acceptEvent(event) -+ pool.transition() -+ -+ self.assertEqual(process1.transitioned, True) -+ self.assertEqual(pool.event_buffer, [event]) # not popped -+ -+ # Ensure pool.last_dispatch has been rolled backward -+ self.assertTrue(pool.last_dispatch < future_time) -+ - def test__dispatchEvent_notready(self): - options = DummyOptions() - from supervisor.states import ProcessStates --- -2.17.1 - diff --git a/src/supervisor/patch/0002-oserror-armhf-assert.patch b/src/supervisor/patch/0002-oserror-armhf-assert.patch deleted file mode 100644 index 0a06bfe711..0000000000 --- a/src/supervisor/patch/0002-oserror-armhf-assert.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/supervisor/tests/test_options.py b/supervisor/tests/test_options.py ---- a/supervisor/tests/test_options.py -+++ b/supervisor/tests/test_options.py -@@ -1514,9 +1514,9 @@ - os.read(innie, 0) # we can read it while its open - os.write(outie, 'foo') # we can write to it while its open - instance.close_fd(innie) -- self.assertRaises(OSError, os.read, innie, 0) -+ #self.assertRaises(OSError, os.read, innie, 0) - instance.close_fd(outie) -- self.assertRaises(OSError, os.write, outie, 'foo') -+ #self.assertRaises(OSError, os.write, outie, 'foo') - - @patch('os.close', Mock(side_effect=OSError)) - def test_close_fd_ignores_oserror(self): - diff --git a/src/supervisor/patch/series b/src/supervisor/patch/series deleted file mode 100644 index 9d87dccfa7..0000000000 --- a/src/supervisor/patch/series +++ /dev/null @@ -1,2 +0,0 @@ -# This series applies on GIT commit 34b690aea8cf7572d73765c95c54a83261d69aad -0001-Prevent-excessive-hanging-and-crashes-if-system-cloc.patch diff --git a/src/supervisor/patch/series-armhf b/src/supervisor/patch/series-armhf deleted file mode 100644 index 6a52e31cbf..0000000000 --- a/src/supervisor/patch/series-armhf +++ /dev/null @@ -1,2 +0,0 @@ -# This series applies on GIT commit 34b690aea8cf7572d73765c95c54a83261d69aad -0002-oserror-armhf-assert.patch