Skip to content

Commit

Permalink
[Bug]: duct-tape:1.0.8 contains a Thread Leak
Browse files Browse the repository at this point in the history
2nd step: call shutdown() when stopping the container

Related to testcontainers#9227.
  • Loading branch information
dadoonet committed Sep 16, 2024
1 parent 259ad3a commit 040bfa7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import org.testcontainers.utility.TestcontainersConfiguration;
import org.testcontainers.utility.ducttape.RateLimiter;
import org.testcontainers.utility.ducttape.RateLimiterBuilder;
import org.testcontainers.utility.ducttape.Timeouts;
import org.testcontainers.utility.ducttape.Unreliables;

import java.io.File;
Expand Down Expand Up @@ -660,6 +661,9 @@ public void stop() {
containerId = null;
containerInfo = null;
}

// If the Timeouts class was used, it created a Thread we need to close
Timeouts.shutdown();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public Thread newThread(Runnable r) {
}
});

public static void shutdown() {
EXECUTOR_SERVICE.shutdown();
}

/**
* Execute a lambda expression with a timeout. If it completes within the time, the result will be returned.
* If it does not complete within the time, a TimeoutException will be thrown.
Expand Down

0 comments on commit 040bfa7

Please sign in to comment.