ADDITIONAL SYSTEM INFORMATION :
We've tested on the following operating systems: Debian 8 and 9, and Ubuntu 16.04.
And these OpenJDK JVM runtimes: multiple versions of 1.8 between 188.8.131.52 and 184.108.40.206, 1.9, and 1.11.
A DESCRIPTION OF THE PROBLEM :
We've run into an issue where our application deadlocks, and when looking at thread dumps we see that threads are waiting for an object monitor that no other thread is currently holding. The thread that the monitor references is parked in a threadpool waiting for its next task.
Test application - https://github.com/djscholl/jemalloc-java-deadlock
Example log output when a deadlock occurred - https://gist.github.com/djscholl/413071ef29671fb53b5a64e105421f1a
See https://github.com/jemalloc/jemalloc/issues/1392 for a more detailed description.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
https://github.com/djscholl/jemalloc-java-deadlock is a test application. There is a README with instructions.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The application should finish all iterations and not exit the loop early.
The application exits the loop early because of a timeout caused by the deadlock.
---------- BEGIN SOURCE ----------
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
So far we've worked around this by not upgrading to jemalloc 5.1. jemalloc 4.5 does not seem to cause the problem. Also glibc malloc does not seem to have the problem.
FREQUENCY : occasionally