Skip to content

Failed to stop password4j-worker thread #162

@fangornoftheforest

Description

@fangornoftheforest

Describe the bug
When deploying a web application using Password4j Tomcat 11 with Java 21, a warning is thrown indicating that the thread password4j-worker-X was not properly stopped when the application shuts down. Possible memory leak.

To Reproduce
Always happens when shutting down, forces an extra shutdown command.

Environment:

  • OS: Windows/Linux
  • JDK: 21
  • Version: 1.8.2

Additional context
05-May-2025 16:36:56.113 WARNING [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [foo] appears to have started a thread named [password4j-worker-20] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.base/jdk.internal.misc.Unsafe.park(Native Method) java.base/java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) java.base/java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3780) java.base/java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3725) java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) java.base/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435) java.base/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1070) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) java.base/java.lang.Thread.run(Thread.java:1583)

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions