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

State transition can take far too long if system clock is set to an earlier time #1043

Closed
jleveque opened this issue Jan 11, 2018 · 4 comments · Fixed by #1047
Closed

State transition can take far too long if system clock is set to an earlier time #1043

jleveque opened this issue Jan 11, 2018 · 4 comments · Fixed by #1047

Comments

@jleveque
Copy link
Contributor

If the system clock is set to an earlier time after a process is started but before it has entered the RUNNING state, supervisorctl start <process_name> can hang for a very long time waiting for the current system time to become greater than self.laststart + self.config.startsecs, depending on how far backward the system time has moved.

I have resolved the issue with the following modification to the transition() function in process.py:

def transition(self):
    now = time.time()
    state = self.state

    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;

   ...

This solution still ensures that the process has remained running for at least self.config.startsecs while only increasing the maximum wait time to 2 * self.config.startsecs if the system clock is detected to have moved backward.

As I'm not too familiar with this code, I'm not sure if this is the best solution, nor am I sure if any other functions may require a check of this nature as well, so I figured I would leave this suggestion here and let a Supervisor dev who is more familiar with the code base decide on the most appropriate solution.

Please let me know if I can be of further assistance.

@mnaberez
Copy link
Member

What version of Supervisor are you using (supervisord --version)?

@jleveque
Copy link
Contributor Author

Version 3.3.2

@jleveque
Copy link
Contributor Author

jleveque commented Jan 12, 2018

To add more context, this is definitely a separate issue from #802. This is not related to the HTTP response issue that was apparently address this is a separate issue which can present similar symptoms.

@jleveque
Copy link
Contributor Author

jleveque commented Mar 6, 2018

I pushed some changes to my PR (#1047) a few weeks ago in an attempt to address your comments. Please review the latest changes when you have a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants