-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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] Add patch to prevent 'supervisorctl start' command from hanging if system time has rolled backward #1311
Merged
jleveque
merged 2 commits into
sonic-net:master
from
jleveque:supervisor_time_rollback_workaround
Jan 18, 2018
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
# supervisor package | ||
|
||
SUPERVISOR = python-supervisor_3.3.2-1_all.deb | ||
SUPERVISOR_VERSION = 3.3.2 | ||
|
||
export SUPERVISOR_VERSION | ||
|
||
SUPERVISOR = python-supervisor_$(SUPERVISOR_VERSION)-1_all.deb | ||
$(SUPERVISOR)_SRC_PATH = $(SRC_PATH)/supervisor | ||
SONIC_MAKE_DEBS += $(SUPERVISOR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/supervisor/patch/0001-Prevent-supervisorctl-start-from-hanging-if-system-t.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
From 9ce7c3273d78dc412e3a1e3c95307a63846bad39 Mon Sep 17 00:00:00 2001 | ||
From: Joe LeVeque <jolevequ@microsoft.com> | ||
Date: Tue, 16 Jan 2018 20:42:13 +0000 | ||
Subject: [PATCH] Prevent 'supervisorctl start' from hanging if system time | ||
rolls backward | ||
|
||
--- | ||
supervisor/process.py | 4 ++++ | ||
1 file changed, 4 insertions(+) | ||
|
||
diff --git a/supervisor/process.py b/supervisor/process.py | ||
index f9ddcd9..d292421 100644 | ||
--- a/supervisor/process.py | ||
+++ b/supervisor/process.py | ||
@@ -588,6 +588,10 @@ class Subprocess: | ||
|
||
logger = self.config.options.logger | ||
|
||
+ # If system clock has moved backward, reset self.laststart to current system time | ||
+ if now < self.laststart: | ||
+ self.laststart = now; | ||
+ | ||
if self.config.options.mood > SupervisorStates.RESTARTING: | ||
# dont start any processes if supervisor is shutting down | ||
if state == ProcessStates.EXITED: | ||
-- | ||
2.1.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0001-Prevent-supervisorctl-start-from-hanging-if-system-t.patch |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am ok with this pariticular fix. however, I think the time travel can cause other problems in the code.
i checked the supervisord code, it looks like there are other places that save the current time to a value and use it later, like self.delay, it could also have the same problem in the back-off process.
if you are in the backoff state, and the system clock moved backward, then you need wait for a long time to catch up and the process won't restart for a long time.
another example is last_dispatch.
this does not sound like a trivial problem. I also see there are some unittest added. I think we need to fix all the problems I see above and add unit test code and add unit test code.