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
diff --git a/runtime/plugin.cc b/runtime/plugin.cc
index 731967c..6aa0787 100644
--- a/runtime/plugin.cc
+++ b/runtime/plugin.cc
@@ -74,10 +74,8 @@
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;
}