-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8329862: libjli GetApplicationHome cleanups and enhance jli tracing #18699
Conversation
👋 Welcome back mbaesken! A progress list of the required criteria for merging this PR into |
@MBaesken This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 243 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
Btw. I noticed that GetModuleFileName return value is not checked, should this be done (at other locations in the JDk codebase it is done) ? |
This looks very ad hoc. Not opposed to expanding the set of trace messages when this env variable is set but what is proposed here looks like trace messages that are left over from a debugging session. If we expand the tracing then I think it should be consistent with the existing tracing. |
I just added some tracing calls where I missed them. Do you think I should do some more adjustments ? |
What exactly do you see as inconsistent ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me this looks useful, although maybe the overall JLI tracing could be revisited.
@@ -321,6 +323,8 @@ GetJREPath(char *path, jint pathsize) | |||
} | |||
} | |||
|
|||
JLI_TraceLauncher("GetJREPath - attempt to get JRE location from shared lib of the image\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a trace also in the USE_REGISTRY_LOOKUP section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Christoph, seems the USE_REGISTRY_LOOKUP is currently unused (at least without additional defines that are not present usually)
src/java.base/windows/native/libjli/java_md.c:52:#ifdef USE_REGISTRY_LOOKUP
src/java.base/windows/native/libjli/java_md.c:333:#ifdef USE_REGISTRY_LOOKUP
I am not sure if this even works any more. Maybe Alan could comment on this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this even works any more. Maybe Alan could comment on this ?
The GetPublicJREHome function was removed at some point, I think JDK 9, as it didn't make sense to have in the OpenJDK project. However, Oracle installer did depend on it and will require a bit of effort to see if removing it now will cause an issue now or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MBaesken I checked into the building with -DUSE_REGISTRY_LOOKUP as that compiled in code that the Oracle installer needed when it copied java.exe to somewhere. This is indeed left over code and can be removed from java_md.c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Alan, thanks for checking this !
I removed the USE_REGISTRY_LOOKUP usages.
Maybe the output of the tracing should look similar to other traces done through |
Okay, makes sense ! I will change that to make the output similar to existing traces. |
I think this is way too ad hoc and looks like lefts over from a debugging session. So I don't think it should be integrated without stepping back and thinking more about what this tracing option is intended for. |
/reviewers 2 |
@AlanBateman |
Currently there seem to be two (with the unused registry stuff 3, if it is still valid ?) approaches to find the 'JRE' location (should this better be named image location?) - using the launcher exe location and using the location of the libjli shared lib. |
I adjusted the trace messages a bit to make the coding more consistent to the existing Jli trace code, |
@@ -82,6 +82,8 @@ GetApplicationHome(char *buf, jint bufsize) | |||
{ | |||
const char *execname = GetExecName(); | |||
if (execname != NULL) { | |||
JLI_TraceLauncher("Launcher executable path is %s\n", execname); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trace seems a bit unsymmetric to its Windows counterpart. Maybe it should be left out here, too, since there is tracing in GetJREPath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This trace seems a bit unsymmetric to its Windows counterpart. Maybe it should be left out here, too, since there is tracing in GetJREPath.
I removed the JLI trace output for the launcher exe path.
Generally this looks more consistent now. Let's see what @AlanBateman thinks... 😄 |
Hi, any additional comments / reviews ? |
It still looks like left over trace messages from a debugging session, need to think about about what tracing make sense here. |
What is the use case for this tracing functionality? I recently was quite helped by it when debugging static java launching. And in that case, the more logging the better. But that sounds like a very special case. Is this something that end users are supposed to use to help solve problems? |
It helped to understand the issue behind https://bugs.openjdk.org/browse/JDK-8329653 |
Not sure if it is really such a special case. Currently both modes (getting the image path from launcher binary path , and getting the image path from 'the dll' / GetApplicationHomeFromDll (libjli.so on Linux) exist and are to my knowledge supported. At least one jtreg test fails when the GetApplicationHomeFromDll does not work any more. |
I agree; the launcher uses two different modes for discovery. If you want to troubleshoot, knowing which of these are attempted is helpful. @AlanBateman If this is not acceptable to add, I must once again iterate my question: What is the use case for the tracing functionality then? |
The tracing was mostly for the options and timing when it was originally added. I don't object to expanding the tracing. The issue is that the proposed additions are inconsistent with the existing trace messages, e.g. GetJREPath's existing trace messages use "JRE path", the proposed messages switch to "JRE location". BTW: the vestiges of the "JRE" should really be removed. The GetJREPath function has no business looking for jre/lib as that location does not exist since JDK 9. |
I adjusted the output ot 'JRE path' .
Is the at/below
part meant? This looks indeed obsolete . |
I changed the added output to 'JRE path' to have more consistency with the existing JLI trace messages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Yes, this is code that doesn't make sense since JDK 9 and should be removed/cleanup at some point. I suspect we had to leave it at the time because of the issue of installers copying java.exe into a shared location and expecting it to work with any JRE or JDK release, something that doesn't make sense now of course. |
I removed the mentioned 'private JRE' check and also the related size check. |
Still looks good. We should maybe change the synopsis (title) of the bug to something like "libjli GetApplicationHome cleanups"? |
Change still good
Well, it does enhance tracing, so the title is not lying :) |
I changed the synopsis because it was indeed now not really reflecting any more what the change does. |
Thanks for the reviews ! /integrate |
Going to push as commit 377f2e5.
Your commit was automatically rebased without conflicts. |
Good, I'll look at it as soon as I can. I suspect we'll need some follow on issues as there are several issues here. |
We have already good JLI tracing capabilities. But GetApplicationHome and GetApplicationHomeFromDll lack some tracing and should be enhanced.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18699/head:pull/18699
$ git checkout pull/18699
Update a local copy of the PR:
$ git checkout pull/18699
$ git pull https://git.openjdk.org/jdk.git pull/18699/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18699
View PR using the GUI difftool:
$ git pr show -t 18699
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18699.diff
Webrev
Link to Webrev Comment