Commit f810159
committed
[JENKINS-76200] Exclude STOPPED instances from capacity calculation
The NoDelayProvisionerStrategy was counting offline STOPPED EC2 instances
as "available capacity", preventing provisioning from being triggered when
jobs were queued. This caused STOPPED instances to remain stopped forever,
with jobs waiting indefinitely.
Root cause:
- countProvisionedButNotExecutingNodes() counted ALL offline nodes
- STOPPED instances were included in available capacity
- When capacity >= demand, provisioning was skipped
- provisionOndemand() was never called to start the stopped instances
Fix:
- Check AWS instance state for offline nodes
- Exclude STOPPED/STOPPING instances from capacity count
- Only count instances that will come online (PENDING/RUNNING)
- Fail-safe: if state check fails, count the instance to avoid over-provisioning
This preserves the fixes from:
- JENKINS-76151: EC2RetentionStrategy still only reconnects RUNNING instances
- JENKINS-76171: Offline PENDING/RUNNING instances still counted to prevent over-provisioning
Testing:
1. Stop an EC2 instance (via AWS or Jenkins stopOnTerminate)
2. Queue a job requiring that label
3. Verify provisioning is triggered and instance starts in AWS
4. Check logs for "Excluding STOPPED instance {id} from available capacity"1 parent e2ec8ee commit f810159
File tree
1 file changed
+28
-3
lines changed- src/main/java/hudson/plugins/ec2
1 file changed
+28
-3
lines changedLines changed: 28 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| 104 | + | |
| 105 | + | |
102 | 106 | | |
103 | 107 | | |
104 | 108 | | |
| |||
113 | 117 | | |
114 | 118 | | |
115 | 119 | | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
136 | 141 | | |
137 | 142 | | |
138 | 143 | | |
139 | | - | |
| 144 | + | |
140 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
141 | 166 | | |
142 | 167 | | |
143 | 168 | | |
144 | 169 | | |
145 | 170 | | |
146 | 171 | | |
147 | | - | |
148 | | - | |
| 172 | + | |
| 173 | + | |
149 | 174 | | |
150 | 175 | | |
151 | 176 | | |
| |||
0 commit comments