From 789a57e79233a76b31337a1144daa21a034ddaa1 Mon Sep 17 00:00:00 2001 From: Nanne Baars Date: Mon, 26 Oct 2015 21:38:30 +0100 Subject: [PATCH] SEVERE: The web application [/WebGoat] appears to have started a thread named [pool-7-thread-5] but has failed to stop it. This is very likely to create a memory leak #124 --- .../owasp/webgoat/plugins/PluginsLoader.java | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/webgoat-container/src/main/java/org/owasp/webgoat/plugins/PluginsLoader.java b/webgoat-container/src/main/java/org/owasp/webgoat/plugins/PluginsLoader.java index 47f533e91..f886ef03a 100644 --- a/webgoat-container/src/main/java/org/owasp/webgoat/plugins/PluginsLoader.java +++ b/webgoat-container/src/main/java/org/owasp/webgoat/plugins/PluginsLoader.java @@ -108,23 +108,27 @@ public class PluginsLoader { } private List processPlugins(List jars) throws Exception { - final List plugins = Lists.newArrayList(); final ExecutorService executorService = Executors.newFixedThreadPool(10); - final CompletionService completionService = new ExecutorCompletionService<>(executorService); - final List> callables = extractJars(jars); + try { + final List plugins = Lists.newArrayList(); + final CompletionService completionService = new ExecutorCompletionService<>(executorService); + final List> callables = extractJars(jars); - for (Callable s : callables) { - completionService.submit(s); - } - int n = callables.size(); - for (int i = 0; i < n; i++) { - Plugin plugin = completionService.take().get(); - if (plugin.getLesson().isPresent()) { - plugins.add(plugin); + for (Callable s : callables) { + completionService.submit(s); } + int n = callables.size(); + for (int i = 0; i < n; i++) { + Plugin plugin = completionService.take().get(); + if (plugin.getLesson().isPresent()) { + plugins.add(plugin); + } + } + LabelProvider.updatePluginResources(pluginTarget.resolve("plugin/i18n/WebGoatLabels.properties")); + return plugins; + } finally { + executorService.shutdown(); } - LabelProvider.updatePluginResources(pluginTarget.resolve("plugin/i18n/WebGoatLabels.properties")); - return plugins; } private List> extractJars(List jars) {