Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[supervisor] Prevent crash if system clock rolls back within startsecs; Refactor patch #2624

Merged
merged 1 commit into from
Mar 4, 2019
Merged

[supervisor] Prevent crash if system clock rolls back within startsecs; Refactor patch #2624

merged 1 commit into from
Mar 4, 2019

Conversation

jleveque
Copy link
Contributor

@jleveque jleveque commented Mar 1, 2019

- What I did

  • Add a patch (and related test) to supervisor in order to prevent a crash when a process has already entered the RUNNING state but then clock rolled back to be less than startsecs. The crash would present itself with log messages similar to the following:
Traceback (most recent call last):
File "/usr/bin/supervisord", line 9, in <module>
load_entry_point('supervisor==3.3.3', 'console_scripts', 'supervisord')()
File "/usr/lib/python2.7/dist-packages/supervisor/supervisord.py", line 363, in main
go(options)
File "/usr/lib/python2.7/dist-packages/supervisor/supervisord.py", line 373, in go
d.main()
File "/usr/lib/python2.7/dist-packages/supervisor/supervisord.py", line 84, in main
self.run()
File "/usr/lib/python2.7/dist-packages/supervisor/supervisord.py", line 101, in run
self.runforever()
File "/usr/lib/python2.7/dist-packages/supervisor/supervisord.py", line 253, in runforever
self.reap()
File "/usr/lib/python2.7/dist-packages/supervisor/supervisord.py", line 289, in reap
process.finish(pid, sts)
File "/usr/lib/python2.7/dist-packages/supervisor/process.py", line 527, in finish
self._assertInState(ProcessStates.STARTING)
File "/usr/lib/python2.7/dist-packages/supervisor/process.py", line 179, in _assertInState
self.config.name, current_state, allowable_states))
AssertionError: Assertion failed for start.sh: RUNNING not in STARTING

- How to verify it

  • Start a one-shot process using supervisor with startsecs set to a value > 0. Shortly after startsecs elapses (which causes supervisor to place the process in the RUNNING state), roll the system clock backward by a value <= startsecs. Then, within the amount of seconds you just rolled the clock back, cause the process to exit. Without this fix, at this point, supervisor will crash. With this fix, supervisor should recognize that the process was already in the RUNNING state and allow the process to exit without crashing.

@lguohan lguohan merged commit e4bb1fc into sonic-net:master Mar 4, 2019
lguohan pushed a commit that referenced this pull request Mar 4, 2019
@jleveque jleveque deleted the supervisor_crash_fix2 branch March 4, 2019 19:40
@yxieca
Copy link
Contributor

yxieca commented Mar 7, 2019

Made to 201811 branch on 3/6/2019

yxieca pushed a commit that referenced this pull request Mar 7, 2019
tiantianlv pushed a commit to SONIC-DEV/sonic-buildimage that referenced this pull request Apr 10, 2019
tiantianlv pushed a commit to SONIC-DEV/sonic-buildimage that referenced this pull request Apr 10, 2019
tiantianlv pushed a commit to SONIC-DEV/sonic-buildimage that referenced this pull request Apr 10, 2019
@mnaberez
Copy link

Supervisor 3.4.0 (PyPI package; includes this patch)

praveen-li pushed a commit to praveen-li/sonic-buildimage that referenced this pull request Feb 9, 2021
The ntpd process will exit silently with "-x" startup option
when the current system time is drifted too far from the ntp
server's time (> 1000 seconds). The option was introduced to
workaround the supervisord issue which was fixed:
sonic-net#2624

We are reverting the change to use "-g" option for ntpd process:
Revert "[ntp] disable ntp time jump (sonic-net#2589)"
This reverts commit a57cb14.

Signed-off-by: Zhenggen Xu <zxu@linkedin.com>

RB=2010953
G=lnos-reviewers
R=pchaudhary,pmao,vapatil,samaity,zxu
A=
yxieca pushed a commit that referenced this pull request Jan 31, 2023
5e84f2525  [202205][show] Add bgpraw to show run all (#2624)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants