[FIXED JENKINS-25759] Avoid consuming too much memory while running validateAntFileMask.

Not fully solved, since the scannedDirs field can still grow to be large, but at least clearing files/dirsNotIncluded.
Also imposing a 5s timeout on the scan regardless of file count, and defining a user-customizable bound.
This commit is contained in:
Jesse Glick committed 2014-11-24 10:37:58 -05:00
1 parent b21827b34a
commit 534328b264
5 files changed
+24 -7

No files matched your search

+4 -1
View File
@@ -56,6 +56,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.jvnet.hudson.test.Issue;
import static org.mockito.Mockito.*;
@@ -496,11 +497,13 @@ public class FilePathTest extends ChannelTestCase {
}
}
@SuppressWarnings("deprecation")
private static void assertValidateAntFileMask(String expected, FilePath d, String fileMasks) throws Exception {
assertEquals(expected, d.validateAntFileMask(fileMasks));
}
@Bug(7214)
@Issue("JENKINS-7214")
@SuppressWarnings("deprecation")
public void testValidateAntFileMaskBounded() throws Exception {
File tmp = Util.createTempDir();
try {