Skip to content

[docker-wait-any] immediately start to wait#77

Closed
stepanblyschak wants to merge 2 commits intomasterfrom
docker-wait-any-fix
Closed

[docker-wait-any] immediately start to wait#77
stepanblyschak wants to merge 2 commits intomasterfrom
docker-wait-any-fix

Conversation

@stepanblyschak
Copy link
Owner

@stepanblyschak stepanblyschak commented Jul 28, 2022

It could happen that a container has already crashed but docker-wait-any
will wait forever till it starts. It should, however, immediately exit
to make the serivce restart.

Signed-off-by: Stepan Blyschak [email protected]

Why I did it

It is observed in some circumstances that the auto-restart mechanism does not work. Specifically for swss.service, orchagent had crashed before docker-wait-any started in swss.sh. This led docker-wait-any wait forever for swss to be in "Running" state and it results in:

CONTAINER ID   IMAGE                                COMMAND                  CREATED        STATUS                    PORTS     NAMES
1abef1ecebff   bcbca2b74df6                         "/usr/local/bin/supe…"   22 hours ago   Up 22 hours                         what-just-happened
3c924d405cd5   docker-lldp:latest                   "/usr/bin/docker-lld…"   22 hours ago   Up 22 hours                         lldp
eb2b12a98c13   docker-router-advertiser:latest      "/usr/bin/docker-ini…"   22 hours ago   Up 22 hours                         radv
d6aac4a46974   docker-sonic-mgmt-framework:latest   "/usr/local/bin/supe…"   22 hours ago   Up 22 hours                         mgmt-framework
d880fd07aab9   docker-platform-monitor:latest       "/usr/bin/docker_ini…"   22 hours ago   Up 22 hours                         pmon
75f9e22d4fdd   docker-snmp:latest                   "/usr/local/bin/supe…"   22 hours ago   Up 22 hours                         snmp
76d570a4bd1c   docker-sonic-telemetry:latest        "/usr/local/bin/supe…"   22 hours ago   Up 22 hours                         telemetry
ee49f50344b3   docker-syncd-mlnx:latest             "/usr/local/bin/supe…"   22 hours ago   Up 22 hours                         syncd
1f0b0bab3687   docker-teamd:latest                  "/usr/local/bin/supe…"   22 hours ago   Up 22 hours                         teamd
917aeeaf9722   docker-orchagent:latest              "/usr/bin/docker-ini…"   22 hours ago   Exited (0) 22 hours ago             swss
81a4d3e820e8   docker-fpm-frr:latest                "/usr/bin/docker_ini…"   22 hours ago   Up 22 hours                         bgp
f6eee8be282c   docker-database:latest               "/usr/local/bin/dock…"   22 hours ago   Up 22 hours                         database

The check for "Running" state is not needed because for cold boot case we do start_peer_and_dependent_services and for warm boot case the loop will retry to wait for container if this container is doing warm boot:

if (container_name in g_dep_services and

How I did it

Removed the check for "Running".

How to verify it

Kill swss before docker-wait-any is reached and verify auto restart will restart swss serivce.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

It could happen that a container has already crashed but docker-wait-any
will wait forever till it starts. It should, however, immediately exit
to make the serivce restart.

Signed-off-by: Stepan Blyschak <[email protected]>
while True:
while docker_client.inspect_container(container_name)['State']['Status'] != "running":
time.sleep(1)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stepanblyschak suggest having a log here:

log.log_info("Waiting on container '{}'".format(container_name))

Signed-off-by: Stepan Blyschak <[email protected]>
stepanblyschak pushed a commit that referenced this pull request Feb 13, 2023
[sonic-linkmgrd][202012] submodule updates

489cf3 Jing Zhang Wed May 18 09:59:02 2022 -0700 Avoid switching active when LinkState == Down (#77)
a6c9713 Jing Zhang Tue May 24 11:03:54 2022 -0700 [202012] Add option to enable or disable default route related feature (#72)
dbb607d Jing Zhang Thu May 12 08:19:20 2022 -0700 [ci]: uplift diff coverage threshold to 80% (#71)

sign-off: Jing Zhang [email protected]
stepanblyschak pushed a commit that referenced this pull request May 20, 2025
…est HEAD automatically (sonic-net#1036)

#### Why I did it
src/sonic-platform-common
```
* 7aadc13 - (HEAD -> 202412, origin/202412) Merge pull request #77 from prgeor/amph-bp (10 hours ago) [Riff]
* b1ab4e6 - Support for Custom Amphenol 800G Backplane catridge (sonic-net#555) (11 hours ago) [Prince George]
```
#### How I did it
#### How to verify it
#### Description for the changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants