Details
-
Type:
Bug
-
Status: Open (View Workflow)
-
Priority:
Major
-
Resolution: Unresolved
-
Component/s: ec2-plugin
-
Labels:None
-
Environment:ec2: 1.42
-
Similar Issues:
Description
Seeing EC2 agent on Linux that will stay connected for a good while and than suddenly get stuck on Connection terminated and never get cleaned up.
This prevents new agents from being provisioned.
I wrote this piece of groovy script to remove orphaned disconnected agents.
Would this PR solve this issue?
import jenkins.model.Jenkins import hudson.plugins.ec2.EC2AbstractSlave println "Cleaning up offline EC2 slaves..." Jenkins.instance.slaves.each { node -> if(!(node in EC2AbstractSlave)) return def computer = node.getComputer() if (computer && !computer.isOffline()) return def logs = computer.getLog() if (!logs) return if (!"Connection terminated".equals(logs.readLines().last())) return println "Deleting ${node.name}" computer.doDoDelete() } null