Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Description of problem:
We observe a native memory leak when repeating JDI operations from Eclipse in a debuggee JVM.
[1280 bytes leaked]
je_prof_backtrace (/home/sandreev/git/misc/jemalloc/src/prof.c:636 (discriminator 2))
je_malloc_default (/home/sandreev/git/misc/jemalloc/src/jemalloc.c:2289)
os::malloc (/data/git/jdk11/src/hotspot/share/runtime/os.cpp:697)
os::malloc (/data/git/jdk11/src/hotspot/share/runtime/os.cpp:660 (discriminator 3))
JvmtiEnvBase::allocate (/data/git/jdk11/src/hotspot/share/prims/jvmtiEnvBase.hpp:195)
JvmtiEnv::Allocate (/data/git/jdk11/src/hotspot/share/prims/jvmtiEnv.cpp:126)
jvmti_Allocate (/data/git/jdk11/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/gensrc/jvmtifiles/jvmtiEnter.cpp:341)
jvmtiAllocate (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/util.c:1794)
bagCreateBag (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/bag.c:45)
eventHelper_createEventBag (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c:930)
insertThread (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c:315)
threadControl_onEventHandlerEntry (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c:2080)
event_callback (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c:605)
cbThreadStart (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c:855)
JvmtiExport::post_thread_start (/data/git/jdk11/src/hotspot/share/prims/jvmtiExport.cpp:1412)
JavaThread::run (/data/git/jdk11/src/hotspot/share/runtime/thread.cpp:1721)
thread_native_entry (/data/git/jdk11/src/hotspot/os/linux/os_linux.cpp:698)
start_thread (/usr/src/debug/glibc-2.17-c758a686/nptl/pthread_create.c:308)
?? (/usr/src/debug////////glibc-2.17-c758a686/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:113)
Version-Release number of selected component (if applicable):
OpenJDK 11
How reproducible:
Run JDI operations with Eclipse in any Java program. E.g. can be done with a command handler:
public class SampleHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Job job = new Job("JDI operation") {
@Override
protected IStatus run(IProgressMonitor monitor) {
int n = 20 * 60;
for (int i = 0; i < n; ++i) {
try {
IJavaDebugTarget javaTarget = getFirstJavaDebugTarget();
if (javaTarget != null) {
IJavaThread javaThread = getFirstSuspendedJavaThread(javaTarget);
if (javaThread != null) {
IJavaType[] javaClass = javaTarget.getJavaTypes("java.lang.String");
if (javaClass[0] instanceof IJavaClassType) {
IJavaClassType jdiClassType = (IJavaClassType) javaClass[0];
IJavaObject instance = jdiClassType.newInstance("()V", null, javaThread);
try {
instance.disableCollection();
if (!monitor.isCanceled()) {
instance.sendMessage("isEmpty", "()Z", null, javaThread, false);
}
} finally {
instance.enableCollection();
}
}
}
}
} catch (DebugException e) {
e.printStackTrace();
}
}
return Status.OK_STATUS;
}
};
job.schedule();
return null;
}
private IJavaDebugTarget getFirstJavaDebugTarget() {
for (IDebugTarget debugTarget : DebugPlugin.getDefault().getLaunchManager().getDebugTargets()) {
if (debugTarget instanceof IJavaDebugTarget) {
return (IJavaDebugTarget) debugTarget;
}
}
return null;
}
private IJavaThread getFirstSuspendedJavaThread(IJavaDebugTarget javaDebugTarget) throws DebugException {
for (IThread thread : javaDebugTarget.getThreads()) {
if (thread.isSuspended() && (thread instanceof IJavaThread)) {
return (IJavaThread) thread;
}
}
return null;
}
}
Actual results:
jemalloc reports a memory leak with the listed stack trace.
Expected results:
No memory is leaked by threadControl_onEventHandlerEntry() in threadControl.c.
Comment 3RHEL Program Management
2023-09-12 21:50:42 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.
Comment 4RHEL Program Management
2023-09-12 21:52:14 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.
Due to differences in account names between systems, some fields were not replicated. Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.
To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer. You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:
"Bugzilla Bug" = 1234567
In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.
Description of problem: We observe a native memory leak when repeating JDI operations from Eclipse in a debuggee JVM. [1280 bytes leaked] je_prof_backtrace (/home/sandreev/git/misc/jemalloc/src/prof.c:636 (discriminator 2)) je_malloc_default (/home/sandreev/git/misc/jemalloc/src/jemalloc.c:2289) os::malloc (/data/git/jdk11/src/hotspot/share/runtime/os.cpp:697) os::malloc (/data/git/jdk11/src/hotspot/share/runtime/os.cpp:660 (discriminator 3)) JvmtiEnvBase::allocate (/data/git/jdk11/src/hotspot/share/prims/jvmtiEnvBase.hpp:195) JvmtiEnv::Allocate (/data/git/jdk11/src/hotspot/share/prims/jvmtiEnv.cpp:126) jvmti_Allocate (/data/git/jdk11/build/linux-x86_64-normal-server-slowdebug/hotspot/variant-server/gensrc/jvmtifiles/jvmtiEnter.cpp:341) jvmtiAllocate (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/util.c:1794) bagCreateBag (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/bag.c:45) eventHelper_createEventBag (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/eventHelper.c:930) insertThread (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c:315) threadControl_onEventHandlerEntry (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c:2080) event_callback (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c:605) cbThreadStart (/data/git/jdk11/src/jdk.jdwp.agent/share/native/libjdwp/eventHandler.c:855) JvmtiExport::post_thread_start (/data/git/jdk11/src/hotspot/share/prims/jvmtiExport.cpp:1412) JavaThread::run (/data/git/jdk11/src/hotspot/share/runtime/thread.cpp:1721) thread_native_entry (/data/git/jdk11/src/hotspot/os/linux/os_linux.cpp:698) start_thread (/usr/src/debug/glibc-2.17-c758a686/nptl/pthread_create.c:308) ?? (/usr/src/debug////////glibc-2.17-c758a686/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:113) Version-Release number of selected component (if applicable): OpenJDK 11 How reproducible: Run JDI operations with Eclipse in any Java program. E.g. can be done with a command handler: public class SampleHandler extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { Job job = new Job("JDI operation") { @Override protected IStatus run(IProgressMonitor monitor) { int n = 20 * 60; for (int i = 0; i < n; ++i) { try { IJavaDebugTarget javaTarget = getFirstJavaDebugTarget(); if (javaTarget != null) { IJavaThread javaThread = getFirstSuspendedJavaThread(javaTarget); if (javaThread != null) { IJavaType[] javaClass = javaTarget.getJavaTypes("java.lang.String"); if (javaClass[0] instanceof IJavaClassType) { IJavaClassType jdiClassType = (IJavaClassType) javaClass[0]; IJavaObject instance = jdiClassType.newInstance("()V", null, javaThread); try { instance.disableCollection(); if (!monitor.isCanceled()) { instance.sendMessage("isEmpty", "()Z", null, javaThread, false); } } finally { instance.enableCollection(); } } } } } catch (DebugException e) { e.printStackTrace(); } } return Status.OK_STATUS; } }; job.schedule(); return null; } private IJavaDebugTarget getFirstJavaDebugTarget() { for (IDebugTarget debugTarget : DebugPlugin.getDefault().getLaunchManager().getDebugTargets()) { if (debugTarget instanceof IJavaDebugTarget) { return (IJavaDebugTarget) debugTarget; } } return null; } private IJavaThread getFirstSuspendedJavaThread(IJavaDebugTarget javaDebugTarget) throws DebugException { for (IThread thread : javaDebugTarget.getThreads()) { if (thread.isSuspended() && (thread instanceof IJavaThread)) { return (IJavaThread) thread; } } return null; } } Actual results: jemalloc reports a memory leak with the listed stack trace. Expected results: No memory is leaked by threadControl_onEventHandlerEntry() in threadControl.c.