Skip to content

[ledd] Use select() with timeout for AppDB notifications#15

Closed
serhepopovych wants to merge 1 commit intosonic-net:masterfrom
OrdnanceNetworks:fix-ledd-signal-handling
Closed

[ledd] Use select() with timeout for AppDB notifications#15
serhepopovych wants to merge 1 commit intosonic-net:masterfrom
OrdnanceNetworks:fix-ledd-signal-handling

Conversation

@serhepopovych
Copy link
Copy Markdown
Contributor

@serhepopovych serhepopovych commented May 26, 2018

Otherwise ledd ignores signals other than SIGKILL making impossible to
use del() destructors in LedClass implementations and delays pmon
docker container shutdown up to 10s.

Here is output from /var/log/supervisor/supervisord.log after
"systemctl stop pmon":

2018-05-26 10:40:36,323 WARN received SIGTERM indicating exit request
2018-05-26 10:40:36,323 INFO waiting for rsyslogd, ledd to die
2018-05-26 10:40:39,327 INFO waiting for rsyslogd, ledd to die
2018-05-26 10:40:42,330 INFO waiting for rsyslogd, ledd to die
2018-05-26 10:40:45,335 INFO waiting for rsyslogd, ledd to die

Note that according to docker-stop(1) default time to wait before retry
with KILL signal is 10s.

Steps to reproduce:

docker exec -ti pmon bash

kill -TERM $(pgrep ledd)

kill -INT $(pgrep ledd)

kill -0 $(pgrep ledd) && echo 'alive'

alive

kill -KILL $(pgrep ledd)

Process survives TERM and INT signals, and killed only in 5) by KILL.

Other C++ code already uses SELECT_TIMEOUT = 1000 to return control
into main loop and checks for state.

Signed-off-by: Sergey Popovich sergey.popovich@ordnance.co

Overwise ledd ignores signals other than SIGKILL making impossible to
use __del__() destructors in LedClass implementations and delays pmon
docker container shutdown up to 10s.

Here is output from /var/log/supervisor/supervisord.log after
"systemctl stop pmon":

  2018-05-26 10:40:36,323 WARN received SIGTERM indicating exit request
  2018-05-26 10:40:36,323 INFO waiting for rsyslogd, ledd to die
  2018-05-26 10:40:39,327 INFO waiting for rsyslogd, ledd to die
  2018-05-26 10:40:42,330 INFO waiting for rsyslogd, ledd to die
  2018-05-26 10:40:45,335 INFO waiting for rsyslogd, ledd to die

Note that according to docker-stop(1) default time to wait before retry
with KILL signal is 10s.

Steps to reproduce:

  # docker exec -ti pmon bash

  # kill -TERM $(pgrep ledd)
  # kill -INT $(pgrep ledd)

  # kill -0 $(pgrep ledd) && echo 'alive'
  alive

  # kill -KILL $(pgrep ledd)

Process survives TERM and INT signals, and killed only in 5) by KILL.

Other C++ code already uses SELECT_TIMEOUT = 1000 to return control
into main loop and checks for state.

Signed-off-by: Sergey Popovich <sergey.popovich@ordnance.co>
@serhepopovych
Copy link
Copy Markdown
Contributor Author

Typos in commit description.

vdahiya12 pushed a commit to vdahiya12/sonic-platform-daemons that referenced this pull request Apr 4, 2022
vdahiya12 pushed a commit to vdahiya12/sonic-platform-daemons that referenced this pull request Apr 4, 2022
vvolam pushed a commit to vvolam/sonic-platform-daemons that referenced this pull request Jun 16, 2025
…-net#15)

Depends on sonic-net/sonic-platform-common#564
<!-- Provide a general summary of your changes in the Title above -->

#### Description
Ignore time wait in `cmis.set_lpmode`

#### Motivation and Context
In `CmisManagerTask`, it calls `cmis.set_lpmode` for each logical port. The time wait causes a `wait_time failure_prs.log skip_prs.log num_of_logical_port` delay in link up time. The PR is to optimize it.

#### How Has This Been Tested?
Manual test
unit test

#### Additional Information (Optional)
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