[JIRA] (JENKINS-57215) Plugin starts a worked and might immediately stop it, because of cached EC2Computer.getUptime()

8 views
Skip to first unread message

umberto.nicoletti@gmail.com (JIRA)

unread,
Apr 29, 2019, 4:36:02 AM4/29/19
to jenkinsc...@googlegroups.com
Umberto Nicoletti created an issue
 
Jenkins / Bug JENKINS-57215
Plugin starts a worked and might immediately stop it, because of cached EC2Computer.getUptime()
Issue Type: Bug Bug
Assignee: Umberto Nicoletti
Components: ec2-plugin
Created: 2019-04-29 08:35
Environment: Jenkins ver. 2.164.2
Amazon EC2 plugin 1.42
Priority: Minor Minor
Reporter: Umberto Nicoletti

AFAIU there's a race condition in EC2RetentionStrategy.java#L99

 

a few lines below the  call to `computer.getUptime()` will return a cached value, whereas `computer.getState();` will not. If the worker was just started, this might lead to a race condition where the uptime will be calculated on the previous start time, rather then the current, and state will instead correctly report running.

As a result of this inconsistency the plugin will end up stopping the instance because it will falsely compute uptime from the previous launch time, rather the current one (time difference from previous launch time is most likely to be more that idle timeout, which for us is 60 minutes).

Does not happen often, perhaps we can just change `computer.getUptime()` to return the actual value rather than a cached value? Ideally calls to `computer` methods should return a consistent view for all getters.

I'm willing to provide a PR, if someone could provide guidance on the suggested solution. Thanks!

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

daniel_atallah@yahoo.com (JIRA)

unread,
Jun 5, 2019, 8:55:01 AM6/5/19
to jenkinsc...@googlegroups.com

john.lengeling@gmail.com (JIRA)

unread,
Jun 20, 2019, 11:02:02 AM6/20/19
to jenkinsc...@googlegroups.com

I ran into this issue using version 1.42/1.43 of the plugin when running a large job that wants to provision 100+ nodes.   I see the PR is approved now, if someone and can get a snapshot build, I will test it out.

fabrizio.manfredi@gmail.com (JIRA)

unread,
Aug 10, 2019, 3:01:02 PM8/10/19
to jenkinsc...@googlegroups.com
FABRIZIO MANFREDI started work on Bug JENKINS-57215
 
Change By: FABRIZIO MANFREDI
Status: Open In Progress

fabrizio.manfredi@gmail.com (JIRA)

unread,
Aug 10, 2019, 3:01:04 PM8/10/19
to jenkinsc...@googlegroups.com
FABRIZIO MANFREDI closed an issue as Fixed
 

Fixed in the 1.45

Change By: FABRIZIO MANFREDI
Status: In Progress Closed
Resolution: Fixed
Released As: 1.45
Reply all
Reply to author
Forward
0 new messages