summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2017-10-16 10:59:26 -0700
committer Alex Light <allight@google.com> 2017-10-16 13:39:49 -0700
commit5b80358a9da889cd2ecf18eb49aa42efa409e582 (patch)
tree71c5fce7e27b9dbd74bd7fd2b62e0633938973ee
parent445e0ec3724b7f4f36bbd218f67a2c9bfbea7669 (diff)
Don't dlclose plugins or agents during shutdown.
We were dlclosing agents and the JVMTI plugin during shutdown but it seems that some agents assume that their code will remain loaded even after the Agent_OnUnload function returns. This caused segfaults during shutdown in some situations. Since the runtime is shutting down anyway there is not much to lose by just not unloading these agents and the plugins they depend on. Test: stress --cpu 60 Test: ./art/tools/run-prebuilt-libjdwp-tests.sh \ --debug \ --test org.apache.harmony.jpda.tests.jdwp.Events.CombinedEventsTest#testCombinedEvents_05 Bug: 67497270 Bug: 67855829 Change-Id: Ib988c0d21bd12d40f33d709e633312eb68021b38
-rw-r--r--runtime/plugin.cc6
-rw-r--r--runtime/ti/agent.cc3
-rw-r--r--tools/libjdwp_art_failures.txt28
-rw-r--r--tools/wrapagentproperties/wrapagentproperties.cc4
4 files changed, 5 insertions, 36 deletions
diff --git a/runtime/plugin.cc b/runtime/plugin.cc
index 731967c738..6aa078771b 100644
--- a/runtime/plugin.cc
+++ b/runtime/plugin.cc
@@ -74,10 +74,8 @@ bool Plugin::Unload() {
LOG(WARNING) << this << " does not include a deinitialization function";
}
dlopen_handle_ = nullptr;
- if (dlclose(handle) != 0) {
- LOG(ERROR) << this << " failed to dlclose: " << dlerror();
- ret = false;
- }
+ // Don't bother to actually dlclose since we are shutting down anyway and there might be small
+ // amounts of processing still being done.
return ret;
}
diff --git a/runtime/ti/agent.cc b/runtime/ti/agent.cc
index 6ff966678a..20e297c991 100644
--- a/runtime/ti/agent.cc
+++ b/runtime/ti/agent.cc
@@ -113,7 +113,8 @@ void Agent::Unload() {
if (onunload_ != nullptr) {
onunload_(Runtime::Current()->GetJavaVM());
}
- dlclose(dlopen_handle_);
+ // Don't actually dlclose since some agents assume they will never get unloaded. Since this only
+ // happens when the runtime is shutting down anyway this isn't a big deal.
dlopen_handle_ = nullptr;
onload_ = nullptr;
onattach_ = nullptr;
diff --git a/tools/libjdwp_art_failures.txt b/tools/libjdwp_art_failures.txt
index bd422e964e..1812177e2f 100644
--- a/tools/libjdwp_art_failures.txt
+++ b/tools/libjdwp_art_failures.txt
@@ -71,34 +71,6 @@
"org.apache.harmony.jpda.tests.jdwp.EventModifiers.InstanceOnlyModifierTest#testMethodExit",
"org.apache.harmony.jpda.tests.jdwp.EventModifiers.InstanceOnlyModifierTest#testMethodExitWithReturnValue" ]
},
-/* TODO Investigate these failures more closely */
-{
- description: "Tests that fail when run on the chromium buildbots against the prebuilt libjdwp.so in certain configurations",
- result: EXEC_FAILED,
- bug: 67497270,
- names: [
- "org.apache.harmony.jpda.tests.jdwp.Events.CombinedEvents003Test#testCombinedEvents003_01",
- "org.apache.harmony.jpda.tests.jdwp.Events.CombinedEventsTest#testCombinedEvents_01",
- "org.apache.harmony.jpda.tests.jdwp.Events.CombinedEventsTest#testCombinedEvents_02",
- "org.apache.harmony.jpda.tests.jdwp.Events.CombinedEventsTest#testCombinedEvents_03",
- "org.apache.harmony.jpda.tests.jdwp.Events.CombinedEventsTest#testCombinedEvents_04",
- "org.apache.harmony.jpda.tests.jdwp.Events.CombinedEventsTest#testCombinedEvents_05",
- "org.apache.harmony.jpda.tests.jdwp.Events.CombinedEventsTest#testCombinedEvents_06",
- "org.apache.harmony.jpda.tests.jdwp.Events.VMDeathTest#testVMDeathEvent",
- "org.apache.harmony.jpda.tests.jdwp.MultiSession.ClassPrepareTest#testClassPrepare001",
- "org.apache.harmony.jpda.tests.jdwp.MultiSession.ExceptionTest#testException001",
- "org.apache.harmony.jpda.tests.jdwp.MultiSession.FieldAccessTest#testFieldAccess001",
- "org.apache.harmony.jpda.tests.jdwp.MultiSession.FieldModificationTest#testFieldModification001",
- "org.apache.harmony.jpda.tests.jdwp.MultiSession.SingleStepTest#testSingleStep001",
- "org.apache.harmony.jpda.tests.jdwp.MultiSession.VMDeathTest#testVMDeathRequest",
- "org.apache.harmony.jpda.tests.jdwp.ReferenceType.SignatureWithGenericTest#testSignatureWithGeneric001",
- "org.apache.harmony.jpda.tests.jdwp.StackFrame.GetValues002Test#testGetValues005_Int2",
- "org.apache.harmony.jpda.tests.jdwp.VirtualMachine.SetDefaultStratumTest#testSetDefaultStratum001",
- "org.apache.harmony.jpda.tests.jdwp.ThreadReference.StatusTest#testStatus001",
- "org.apache.harmony.jpda.tests.jdwp.VirtualMachine.AllClassesTest#testAllClasses002",
- "org.apache.harmony.jpda.tests.jdwp.VirtualMachine.AllClassesWithGenericTest#testAllClassesWithGeneric001"
- ]
-},
/* TODO Categorize these failures more. */
{
description: "Tests that fail on both ART and RI. These tests are likely incorrect",
diff --git a/tools/wrapagentproperties/wrapagentproperties.cc b/tools/wrapagentproperties/wrapagentproperties.cc
index dca627046e..67d5279672 100644
--- a/tools/wrapagentproperties/wrapagentproperties.cc
+++ b/tools/wrapagentproperties/wrapagentproperties.cc
@@ -45,7 +45,6 @@ static std::mutex unload_mutex;
struct Unloader {
AgentUnloadFunction unload;
- void* dlclose_handle;
};
static std::vector<Unloader> unload_functions;
@@ -71,7 +70,6 @@ struct ProxyJavaVM {
std::lock_guard<std::mutex> lk(unload_mutex);
unload_functions.push_back({
reinterpret_cast<AgentUnloadFunction>(dlsym(dlopen_handle, kOnUnload)),
- dlopen_handle
});
}
attach = reinterpret_cast<AgentLoadFunction>(dlsym(dlopen_handle, kOnAttach));
@@ -337,7 +335,7 @@ extern "C" JNIEXPORT void JNICALL Agent_OnUnload(JavaVM* jvm) {
std::lock_guard<std::mutex> lk(unload_mutex);
for (const Unloader& u : unload_functions) {
u.unload(jvm);
- dlclose(u.dlclose_handle);
+ // Don't dlclose since some agents expect to still have code loaded after this.
}
unload_functions.clear();
}