Make Computer#getLogDir thread-safe
@@ -195,6 +195,8 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
protected final Object statusChangeLock = new Object();
+ private final Object logDirLock = new String("logDirLock");
+
/**
* Keeps track of stack traces to track the termination requests for this computer.
*
@@ -303,11 +305,13 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
*/
protected @NonNull File getLogDir() {
File dir = new File(Jenkins.get().getRootDir(),"logs/slaves/"+nodeName);
+ synchronized (logDirLock) {
try {
IOUtils.mkdirs(dir);
} catch (IOException x) {
LOGGER.log(Level.SEVERE, "Failed to create agent log directory " + dir, x);
}
+ }
return dir;
}
