Skip to content

Commit

Permalink
make analysis timeout configurable per #936
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylong committed Jun 17, 2018
1 parent 8951e26 commit 9b9b749
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/src/main/java/org/owasp/dependencycheck/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,8 @@ protected void executeAnalysisTasks(Analyzer analyzer, List<Throwable> exception
final ExecutorService executorService = getExecutorService(analyzer);

try {
final List<Future<Void>> results = executorService.invokeAll(analysisTasks, 10, TimeUnit.MINUTES);
final int timeout = settings.getInt(Settings.KEYS.TEMP_DIRECTORY, 20);
final List<Future<Void>> results = executorService.invokeAll(analysisTasks, timeout, TimeUnit.MINUTES);

// ensure there was no exception during execution
for (Future<Void> result : results) {
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/resources/dependencycheck.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ data.file_name=dc.h2.db
### the gradle PurgeDataExtension.
data.version=3.0

#The analysis timeout in minutes
odc.analysis.timeout=20

data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;LOG=0;CACHE_SIZE=65536;
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck

Expand Down
4 changes: 4 additions & 0 deletions core/src/test/resources/dependencycheck.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ data.directory=[JAR]/data
#if the filename has a %s it will be replaced with the current expected version
data.file_name=dc.h2.db
data.version=3.0

#The analysis timeout in minutes
odc.analysis.timeout=20

data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;LOG=0;CACHE_SIZE=65536;
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ public static final class KEYS {
* The maximum number of threads to allocate when downloading files.
*/
public static final String MAX_DOWNLOAD_THREAD_POOL_SIZE = "max.download.threads";
/**
* The properties key for the analysis timeout.
*/
public static final String ANALYSIS_TIMEOUT = "odc.analysis.timeout";
/**
* The key for the suppression file.
*/
Expand Down
4 changes: 4 additions & 0 deletions utils/src/test/resources/dependencycheck.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ data.directory=[JAR]/data
#if the filename has a %s it will be replaced with the current expected version
data.file_name=dc.h2.db
data.version=3.0

#The analysis timeout in minutes
odc.analysis.timeout=20

data.connection_string=jdbc:h2:file:%s;MV_STORE=FALSE;AUTOCOMMIT=ON;LOG=0;CACHE_SIZE=65536;
#data.connection_string=jdbc:mysql://localhost:3306/dependencycheck

Expand Down

0 comments on commit 9b9b749

Please sign in to comment.