-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more flexibility for loading a DTFJ implementation #30
Comments
Oct 12, 2020 18:56 New Gerrit change created: https://git.eclipse.org/r/c/mat/org.eclipse.mat/+/170676 |
By Kevin Grigorenko on Oct 12, 2020 19:16 First proposed patch submitted to Gerrit. Major points:
a. If the user has specified explicit directories through the DTFJ preferences page containing dtfj.jar and j9ddr.jar, then search those for those JARs and add to the CustomClassLoader JAR URL list. b. Otherwise, if the user has not checked the "Skip IBM DTFJ feature (if installed)" preference, then search the Eclipse installation for the IBM DTFJ plugin and find the dtfj.jar and j9ddr.jar within it. c. If the "skip" option is selected or there have yet to be any DTFJ JARs found, search the java.home directory for the JARs. d. If any JARs have yet to be found, do not add any JARs to the JAR URL list of the CustomClassLoader and thus we will defer to ClassLoader.getSystemClassLoader e. For the 34 interfaces and exceptions that are used by org.eclipse.mat.dtfj, we explicitly check for those and load from the OSGi classloader.
[INFO] BUILD SUCCESS
|
By Kevin Grigorenko on Oct 13, 2020 16:41 Create contribution questionnaire CQ22718: https://dev.eclipse.org/ipzilla/show_bug.cgi?id=22718 |
By Andrew Johnson on Oct 25, 2020 11:28 I've tried the code and it solves a lot of the problems. A remaining problem is how one installation of MAT could parse dumps from difference sources without being reconfigured. I'd like to see a plan for how this could be done (perhaps multiple concurrent implementations loaded inside dtfj.bridge or the dtfj plugin itself seeing multiple implementations and deciding at JavaRuntime.getVersion time). Longer term I would like to know if it would be possible to read OpenJ9 Java 11 and later dumps from non-OpenJ9 VMs but perhaps that is going to be an OpenJ9 restriction. It also seems a bit odd going inside the old IBM DTFJ bundles and reading the jars (if that is what happens) rather than using OSGi class loading on the bundle, but perhaps there are difficulties in getting an old DTFJ implementation to use the dtfj bridge DTFJ API classes. |
By Kevin Grigorenko on Oct 26, 2020 10:49 (In reply to Andrew Johnson from comment #4)
Thanks
I agree. Ideally, a user should be able to configure a set of JREs, MAT starts by parsing out just the JRE version from the dump, and then switches to parsing with a matching JRE. However, in addition to keeping things simple at first, the main reason I haven't worked on this yet is the issue of Java >= 9 DTFJ. My initial tests showed that we could not dynamically load a Java >= 9 DTFJ from a directory using Java 8 as a MAT pre-req. So I think the next step towards this goal would be for MAT to pre-req Java 11 and then I can try out the above design. Here are my notes for posterity: Loading openj9.dtfj.jmod doesn't work because the newer ImageFactory depends on jdk.internal.module.Modules:
We'll have to discuss with Keith on the precise design and its implications.
Initially, I tried to use OSGi classloading but I couldn't figure out how to keep the classes sandboxed; after loading the implementation classes once, a subsequent load of alternative classes caused ClassCastExceptions. The current design sandboxes everything within the CustomClassLoader to avoid anything being loaded inside OSGi classloaders (other than the 34 interfaces and exceptions). I did find details on advanced OSGi dynamic classloading but I liked the approach of just using the loose JARs because that unifiied the classloading with the configured JAR option and made the code simpler. The CQ is still in the approval pipeline and I've just followed up to see if there's any ETA. |
By Kevin Grigorenko on Oct 27, 2020 09:58 Hey Andrew, feedback was received on the CQ issue https://dev.eclipse.org/ipzilla/show_bug.cgi?id=22718:
the content into your project’s source code repository. If a repository has not Are you okay with moving forward with this patch? If so, I'll update the patch with documentation updates and submit for a final review. |
By Kevin Grigorenko on Jan 27, 2021 10:52 Hey Andrew, I received a notice that the CQ has been approved. Note also that I have created an internal build of MAT used by all of IBM support and added this patch to it. We can let this patch bake there for some time to see if any issues arise before considering it for core MAT. |
Jan 14, 2022 09:36 New Gerrit change created: https://git.eclipse.org/r/c/mat/org.eclipse.mat/+/189638 |
By Kevin Grigorenko on Nov 29, 2022 09:23 I noticed an update to this bug and I read my last comment on it:
I just wanted to clarify that I abandoned this approach and we currently have two separate launchers and the user must choose the right launcher based on the dump they plan to parse. I haven't had time to investigate a new patch that works with Java 11 and up. |
| --- | --- |
| Bugzilla Link | 567819 |
| Status | NEW |
| Importance | P3 normal |
| Reported | Oct 12, 2020 18:50 EDT |
| Modified | Nov 29, 2022 09:23 EDT |
| See also | Gerrit change 170676, Gerrit change 189638 |
| Reporter | Kevin Grigorenko |
Description
This is a follow-on to bug 558984; although that was resolved with an updated IBM DTFJ plugin, there have been other issues related to loading Java 11 dumps and OpenJ9 dumps. The DTFJ plugin system does allow multiple plugins in theory, but that just has to brute force search for one that works, and issues often arise related to non-fatal parsing errors. Therefore, it would be nice to give users more flexibility in choosing which DTFJ is used to parse a J9 dump.
This bug proposes adding flexibility to the DTFJ plugin system:
The text was updated successfully, but these errors were encountered: