-
-
Notifications
You must be signed in to change notification settings - Fork 126
[FIXED JENKINS-26521] Add activity flag to timeout step #62
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
Conversation
Many thanks to @ikedam for the original version of this. I've just resurrected it and tweaked a couple things.
|
And what about #19? |
jglick
left a comment
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.
Will work for now, but is going to break in conjunction with jenkinsci/workflow-support-plugin#15 because the ConsoleLogFilterImpl, while Serializable to program.dat, will not be remotable. You would need to create some kind of exported object to signal the master side that the timer should be reset.
| private long timeout = 0; | ||
| private long end = 0; | ||
|
|
||
| /** Used to track whether this is timing out on inactivity without needing to reference {@link #step}. */ |
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.
Why not just delete the step field altogether at this point?
| private static class ConsoleLogFilterImpl extends ConsoleLogFilter implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| private final ResetCallback callback; |
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.
Easier to just make ConsoleLogFilterImpl nonstatic and inline logWritten.
| + " echo 'NotHere';\n" | ||
| + " sleep 3;\n" | ||
| + " echo 'NotHereYet';\n" | ||
| + " sleep 3;\n" |
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.
Test could be flaky on loaded CI systems if you have only a 1s buffer.
|
The reliance on reading the logs here makes me rather nervous -- I can't put a finger on something clearly wrong with it per se, but it seems like it might open up some potential stability issues. We need to be really, really careful that we're not thrashing the system by forcing heavy log read activity. |
|
@svanoort - Yeah, I agree. This works but I don't love it. I'd made some vague efforts in the direction of implementing this before finding #18 - nothing else I could come up with would actually work. Particularly because the actual intent here really is to emulate build-timeout's "timeout if nothing new is written to the log" functionality - there really isn't much we can do there but sniff the logs in some way. |
|
@jglick - might it make sense to actually make "timeout on log inactivity" part of |
|
@abayer perhaps. There could be some use cases for checking inactivity on miscellaneous long-running steps producing output—for example, if there is a step which tails a log from a grid engine. On the other hand I agree that But I do not think such a proposal really simplifies anything. Indeed what I meant by my comment was not that this PR is fundamentally incompatible with an external log sink—only that the current implementation is. jenkinsci/workflow-durable-task-step-plugin#21 means that the ¹Unfortunately while we have a |
I see no reason for worry. This PR does not “read” anything. It merely intercepts log writes. Yes the |
|
Where exactly would we be calling |
|
And is there an existing example of this sort of thing you could point me to? |
| long now = System.currentTimeMillis(); | ||
| end = now + GRACE_PERIOD; | ||
| setupTimer(now); | ||
| resetTimer(); |
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.
Something strange.
end will be overridden soon in resetTimer.
From either |
|
@jglick - So would we need to behave differently depending on whether we have a |
|
See abayer#1. |
Showing how to do Channel.export
|
@jglick - Thanks! That was very similar to what I was hacking together anyway, just...well, simpler. =) |
svanoort
left a comment
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.
Blocking briefly so I can give this one more pass before we release.
|
Ping @svanoort |
| @Override | ||
| public void onResume() { | ||
| setupTimer(System.currentTimeMillis()); | ||
| setupTimer(System.currentTimeMillis(), false); |
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.
@abayer I wonder a bit about what the implications are for not resetting activity-based timers at resume... if we're looking at logs, won't the timer trip if Jenkins has been down for a while, and it takes a little bit to get the new log data?
Then again we also trip normal timers at restart too I guess.
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.
Yeah, I'm not sure what the ideal approach here would be, so I'd say let's go with this to start and change it in the future if needed. =)
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 have found issue with timeout activity, described in:
https://issues.jenkins.io/browse/JENKINS-58752
How additional logs could be taken from Jenkins, to investigate that issue?
svanoort
left a comment
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 still feel nervous about this one, but in the interests of unblocking will approve it, since I cannot point to anything specific that needs to be changed.
The logging approach at least seems reasonable (essentially intercepting writes).
JENKINS-26521
Replaces #18
Many thanks to @ikedam for the original version of this. I've just resurrected it and tweaked a couple things.
cc @reviewbybees