jenkinsci / jenkinsci/ec2-plugin

[JENKINS-59520] EC2 Plugin 'Maximum Total Uses' counter resets itself when Stop/Disconnect on Idle Timeout is used

Open
#1,701 2 comments 0 reactions 0 assignees View on GitHub
component:ec2-plugin imported-jira-issue priority:minor resolution:unresolved
Dominant language
Java
Stars
292
Forks
709
Avg merge
3d 16h
Merged PRs (30d)
4

Description

My expectation of selecting 'Stop/Disconnect on Idle Timeout' and setting a Maximum Total Uses value of, say, 10, would be that after running 5 jobs, the instance being stopped due to idle timeout, then 5 more jobs running on that instance, the instance would be terminated and the next job would launch on a new instance. 

 

What I am seeing is that after running 5 jobs and the Maximum Total Uses number dropping to 5, after the agent instance stops, and is then started again, the Maximum Total Uses remaining number resets itself to 10. The same instance has been used 5 times but that information is lost. Is this behaviour expected? If not, would a pull request be accepted or a fix be available to maintain the number of uses remaining across starting and stopping of an instance?

 

Many thanks

---
Originally reported by marcj, imported from: EC2 Plugin 'Maximum Total Uses' counter resets itself when Stop/Disconnect on Idle Timeout is used


  • assignee: thoulen
  • status: Open
  • priority: Minor
  • component(s): ec2-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 3
  • imported: 2025-12-06

Raw content of original issue

My expectation of selecting 'Stop/Disconnect on Idle Timeout' and setting a Maximum Total Uses value of, say, 10, would be that after running 5 jobs, the instance being stopped due to idle timeout, then 5 more jobs running on that instance, the instance would be terminated and the next job would launch on a new instance. 

 

What I am seeing is that after running 5 jobs and the Maximum Total Uses number dropping to 5, after the agent instance stops, and is then started again, the Maximum Total Uses remaining number resets itself to 10. The same instance has been used 5 times but that information is lost. Is this behaviour expected? If not, would a pull request be accepted or a fix be available to maintain the number of uses remaining across starting and stopping of an instance?

 

Many thanks

environment

```
EC2 Plugin 1.45

Jenkins 2.176.3
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the EC2 plugin's Maximum Total Uses behavior with Stop/Disconnect on Idle Timeout, using the Jenkins 2.176.3 and EC2 Plugin 1.45 environment described. Trace the idle-timeout stop/start lifecycle and the remaining-use counter; done means five uses remain consumed after restart and the instance is terminated after ten total uses.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, java
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.