[JIRA] (JENKINS-60308) CompositeIoException is unhelpful for diagnostics

2 views
Skip to first unread message

jnord@cloudbees.com (JIRA)

unread,
Nov 27, 2019, 12:45:02 PM11/27/19
to jenkinsc...@googlegroups.com
James Nord created an issue
 
Jenkins / Bug JENKINS-60308
CompositeIoException is unhelpful for diagnostics
Issue Type: Bug Bug
Assignee: Unassigned
Components: core
Created: 2019-11-27 17:44
Priority: Major Major
Reporter: James Nord

The causes of a CompositeIoException are lost when the exception is rethrown as part of a chain, (ie it is a cause in another Throwable).

 

This is because Throwable.printStackTrace() does not call printStackTrace on its causes but rather printEnclosedStackTrace to handle circular references and prevent a thread loop.

 

This is exceptionally painful when upgrading to 2.204 for the most recent LTS as something in that chain causes tests to fail if the temporary JenkinsHome of a JenkinsRule Test can not be cleans.

it results in failures like:

[2019-11-27T17:04:38.004Z] [ERROR] com.cloudbees.Blah.someTest  Time elapsed: 7.157 s  <<< ERROR!
[2019-11-27T17:04:38.004Z] java.io.IOException: Failed to clean up temp dirs
[2019-11-27T17:04:38.004Z] 	at org.jvnet.hudson.test.TemporaryDirectoryAllocator.dispose(TemporaryDirectoryAllocator.java:96)
[2019-11-27T17:04:38.004Z] 	at org.jvnet.hudson.test.TestEnvironment.dispose(TestEnvironment.java:84)
[2019-11-27T17:04:38.004Z] 	at org.jvnet.hudson.test.JenkinsRule.after(JenkinsRule.java:511)
[2019-11-27T17:04:38.004Z] 	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:614)
[2019-11-27T17:04:38.004Z] 	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
[2019-11-27T17:04:38.004Z] 	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
[2019-11-27T17:04:38.004Z] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2019-11-27T17:04:38.004Z] 	at java.lang.Thread.run(Thread.java:748)
[2019-11-27T17:04:38.004Z] Caused by: jenkins.util.io.CompositeIOException: Unable to delete 'C:\e4909a8e\workspace\operations-center-context_PR-382\target\tmp\j h2709724025285257367'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
[2019-11-27T17:04:38.004Z] 	at jenkins.util.io.PathRemover.forceRemoveRecursive(PathRemover.java:99)
[2019-11-27T17:04:38.004Z] 	at hudson.Util.deleteRecursive(Util.java:293)
[2019-11-27T17:04:38.004Z] 	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1271)
[2019-11-27T17:04:38.004Z] 	at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1267)
[2019-11-27T17:04:38.004Z] 	at hudson.FilePath.act(FilePath.java:1075)
[2019-11-27T17:04:38.004Z] 	at hudson.FilePath.act(FilePath.java:1058)
[2019-11-27T17:04:38.004Z] 	at hudson.FilePath.deleteRecursive(FilePath.java:1265)
[2019-11-27T17:04:38.004Z] 	at org.jvnet.hudson.test.TemporaryDirectoryAllocator.dispose(TemporaryDirectoryAllocator.java:91)
[2019-11-27T17:04:38.004Z] 	... 7 more

This is exceptionally painful on windows where you can not delete a directory if the same process has files open in it, and when the failure is on a CI system and the developers all have Linux/Mac then it becomes even harder.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

jnord@cloudbees.com (JIRA)

unread,
Nov 27, 2019, 12:48:02 PM11/27/19
to jenkinsc...@googlegroups.com
James Nord updated an issue
Change By: James Nord
The causes of a CompositeIoException are lost when the exception is rethrown as part of a chain, (ie it is a cause in another Throwable).

 

This is because Throwable.printStackTrace() does not call printStackTrace on its causes but rather printEnclosedStackTrace to handle circular references and prevent a thread loop.

 

This is exceptionally painful when upgrading to 2.204 for the most recent LTS as something in that chain causes tests to fail if the temporary JenkinsHome of a JenkinsRule Test can not be cleans.

it results in failures like:


{noformat}

[2019-11-27T17:04:38.004Z] [ERROR] com.cloudbees.Blah.someTest  Time elapsed: 7.157 s  <<< ERROR!
[2019-11-27T17:04:38.004Z] java.io.IOException: Failed to clean up temp dirs
[2019-11-27T17:04:38.004Z]  at org.jvnet.hudson.test.TemporaryDirectoryAllocator.dispose(TemporaryDirectoryAllocator.java:96)
[2019-11-27T17:04:38.004Z]  at org.jvnet.hudson.test.TestEnvironment.dispose(TestEnvironment.java:84)
[2019-11-27T17:04:38.004Z]  at org.jvnet.hudson.test.JenkinsRule.after(JenkinsRule.java:511)
[2019-11-27T17:04:38.004Z]  at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:614)
[2019-11-27T17:04:38.004Z]  at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
[2019-11-27T17:04:38.004Z]  at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
[2019-11-27T17:04:38.004Z]  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[2019-11-27T17:04:38.004Z]  at java.lang.Thread.run(Thread.java:748)
[2019-11-27T17:04:38.004Z] Caused by: jenkins.util.io.CompositeIOException: Unable to delete 'C:\e4909a8e\workspace\operations-center-context_PR-382\target\tmp\j h2709724025285257367'. Tried 3 times (of a maximum of 3) waiting 0.1 sec between attempts.
[2019-11-27T17:04:38.004Z]  at jenkins.util.io.PathRemover.forceRemoveRecursive(PathRemover.java:99)
[2019-11-27T17:04:38.004Z]  at hudson.Util.deleteRecursive(Util.java:293)
[2019-11-27T17:04:38.004Z]  at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1271)
[2019-11-27T17:04:38.004Z]  at hudson.FilePath$DeleteRecursive.invoke(FilePath.java:1267)
[2019-11-27T17:04:38.004Z]  at hudson.FilePath.act(FilePath.java:1075)
[2019-11-27T17:04:38.004Z]  at hudson.FilePath.act(FilePath.java:1058)
[2019-11-27T17:04:38.004Z]  at hudson.FilePath.deleteRecursive(FilePath.java:1265)
[2019-11-27T17:04:38.004Z]  at org.jvnet.hudson.test.TemporaryDirectoryAllocator.dispose(TemporaryDirectoryAllocator.java:91)
[2019-11-27T17:04:38.004Z]  ... 7 more{noformat}

This is exceptionally painful on windows where you can not delete a directory if the same process has files open in it, and when the failure is on a CI system and the developers all have Linux/Mac then it becomes even harder.


without knowing which file(s) could not be deleted you are effectively fishing.   You can inspect the exception if you are lucky enough to trap it locally to obtain the info, but this is unlikely to happen for a running Jenkins instance or a test running in CI.
Reply all
Reply to author
Forward
0 new messages