java.lang.IllegalStateException: Timer already cancelled.

Jenkins JIRA | Jesse Glick | 4 years ago
  1. 0

    A user reported that his (SSH) slaves repeatedly failed to launch with the following error: {code:none} ... Copied classworlds.jar Evacuated stdout ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins. java.lang.IllegalStateException: Timer already cancelled. at java.util.Timer.sched(Timer.java:397) at java.util.Timer.schedule(Timer.java:193) at net.bull.javamelody.NodesCollector.scheduleCollectNow(NodesCollector.java:110) at org.jvnet.hudson.plugins.monitoring.NodesListener.onOnline(NodesListener.java:51) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:472) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:340) at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:678) at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:472) at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:223) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) […] [SSH] Connection closed. ERROR: Connection terminated java.io.IOException: Unexpected termination of the channel at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50) Caused by: ... {code} After disabling the Monitoring plugin the problem went away. Not sure what the root cause is, but catching {{IllegalStateException}} from {{scheduleCollectNow}} and reporting it gracefully with diagnostics seems like a good idea. Probably {{SlaveComputer.setChannel}} should also be trapping exceptions from listeners it calls. {{hudson.Util}} may need a convenience method to call a listener method (as a {{Runnable}}? for future lambdas) catching any {{RuntimeException}} or {{LinkageError}} and politely reporting the error so the caller can continue (maybe even blacklisting the listener for future calls so you do not fill up your log, listing the plugin name and version owning the listener class, etc.).

    Jenkins JIRA | 4 years ago | Jesse Glick
    java.lang.IllegalStateException: Timer already cancelled.
  2. 0

    A user reported that his (SSH) slaves repeatedly failed to launch with the following error: {code:none} ... Copied classworlds.jar Evacuated stdout ERROR: Unexpected error in launching a slave. This is probably a bug in Jenkins. java.lang.IllegalStateException: Timer already cancelled. at java.util.Timer.sched(Timer.java:397) at java.util.Timer.schedule(Timer.java:193) at net.bull.javamelody.NodesCollector.scheduleCollectNow(NodesCollector.java:110) at org.jvnet.hudson.plugins.monitoring.NodesListener.onOnline(NodesListener.java:51) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:472) at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:340) at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:678) at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:472) at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:223) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) […] [SSH] Connection closed. ERROR: Connection terminated java.io.IOException: Unexpected termination of the channel at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:50) Caused by: ... {code} After disabling the Monitoring plugin the problem went away. Not sure what the root cause is, but catching {{IllegalStateException}} from {{scheduleCollectNow}} and reporting it gracefully with diagnostics seems like a good idea. Probably {{SlaveComputer.setChannel}} should also be trapping exceptions from listeners it calls. {{hudson.Util}} may need a convenience method to call a listener method (as a {{Runnable}}? for future lambdas) catching any {{RuntimeException}} or {{LinkageError}} and politely reporting the error so the caller can continue (maybe even blacklisting the listener for future calls so you do not fill up your log, listing the plugin name and version owning the listener class, etc.).

    Jenkins JIRA | 4 years ago | Jesse Glick
    java.lang.IllegalStateException: Timer already cancelled.
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Crash

    GitHub | 2 years ago | sadris
    java.lang.IllegalStateException: Timer already cancelled.
  5. 0

    Java util.Timer, how to reset?

    Stack Overflow | 3 years ago | k_wave
    java.lang.IllegalStateException: Timer already cancelled.

  1. eti22 2 times, last 3 weeks ago
  2. mauritius 4 times, last 3 days ago
  3. poroszd 2 times, last 3 months ago
  4. Stefan Braune 3 times, last 6 months ago
  5. dmitry 1 times, last 7 months ago
3 more registered users
4 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    Timer already cancelled.

    at java.util.Timer.sched()
  2. Java RT
    Timer.schedule
    1. java.util.Timer.sched(Timer.java:397)
    2. java.util.Timer.schedule(Timer.java:193)
    2 frames
  3. net.bull.javamelody
    NodesCollector.scheduleCollectNow
    1. net.bull.javamelody.NodesCollector.scheduleCollectNow(NodesCollector.java:110)
    1 frame
  4. org.jvnet.hudson
    NodesListener.onOnline
    1. org.jvnet.hudson.plugins.monitoring.NodesListener.onOnline(NodesListener.java:51)
    1 frame
  5. Hudson
    SlaveComputer.setChannel
    1. hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:472)
    2. hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:340)
    2 frames
  6. hudson.plugins.sshslaves
    SSHLauncher.launch
    1. hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:678)
    2. hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:472)
    2 frames
  7. Hudson
    SlaveComputer$1.call
    1. hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:223)
    1 frame
  8. Java RT
    Thread.run
    1. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    2. java.util.concurrent.FutureTask.run(FutureTask.java:166)
    3. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    4. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    5. java.lang.Thread.run(Thread.java:722)
    5 frames