From 2c4516dcf2db59727eec9180886fa39cc9f78a1a Mon Sep 17 00:00:00 2001 From: Kohsuke Kawaguchi Date: Tue, 28 Jun 2011 22:18:36 -0700 Subject: [PATCH] [FIXED JENKINS-10113] try to work extra hard before giving up the file deletion. --- core/src/main/java/hudson/Util.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/Util.java b/core/src/main/java/hudson/Util.java index d071b3a62e..41fd3ee70c 100644 --- a/core/src/main/java/hudson/Util.java +++ b/core/src/main/java/hudson/Util.java @@ -302,7 +302,16 @@ public class Util { public static void deleteRecursive(File dir) throws IOException { if(!isSymlink(dir)) deleteContentsRecursive(dir); - deleteFile(dir); + try { + deleteFile(dir); + } catch (IOException e) { + // if some of the child directories are big, it might take long enough to delete that + // it allows others to create new files, causing problemsl ike JENKINS-10113 + // so give it one more attempt before we give up. + if(!isSymlink(dir)) + deleteContentsRecursive(dir); + deleteFile(dir); + } } /*