-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
8254702: jpackage app launcher crashes on CentOS #2320
8254702: jpackage app launcher crashes on CentOS #2320
Conversation
👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into |
@alexeysemenyukoracle The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
@@ -0,0 +1,9 @@ | |||
{ |
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.
Linker script is "just in case" to guarantee that only controlled set of functions is exported from launcher lib. Current set of g++ OpenJDK command line options disables export of functions with external linkage by default. However in my local builds this was not the case and the whole C++ runtime statically linked in launcher lib got exported. This prevented it from unloading from launcher's process memory when it was dlclose()
-ed. This linker script used in linkage of launcher lib will guarantee this will not happen.
@@ -52,13 +52,13 @@ tstring unsafe_format(tstring::const_pointer format, ...) { | |||
#ifdef _MSC_VER | |||
ret = _vsntprintf_s(&*fmtout.begin(), fmtout.size(), _TRUNCATE, format, args); | |||
#else | |||
#ifdef __GNUC__ |
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.
Local build with older g++compiler bugfix.
Webrevs
|
/label add core-libs |
@prrace |
So after this change if you bundle and run an app on Linux and then do "ps" .. what is shown to be running ? Java or the app-name you expected ? |
"ps" will show app-name. It was never Java for jpackage apps before this patch and this patch doesn't change it. |
14d277a
to
b493bcf
Compare
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 whole change seems very messy to me. :-(
I'm having a hard time even untangling the PR to understand what's going on. Are you creating two new directories, "applauncherlib" and "applauncherlibcommon"? First of all, for shared libraries, the norm is to have a "lib-" prefix, not a "-lib" suffix. Secondly, there is already a "common" directory, is that not enough?
)) | ||
|
||
$(BUILD_JPACKAGE_APPLAUNCHEREXE): $(call FindLib, java.base, java) |
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.
Why did you remove this dependency?
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 moved it to the bottom of the file making all artifacts produced by make/modules/jdk.jpackage/Lib.gmk depend on java.bas and java. There is $(JPACKAGE_TARGETS): $(call FindLib, java.base, java)
at the bottom of the file.
"common" was perfectly enough until this change. Unfortunately we cant just drop new C sources in "common" dir because we don't want them to be compiled with g++. That is why need new common directory (applauncherlibcommon) for C sources. I'll rename applauncherlibcommon in libapplaunchercommon and applauncherlib in libapplauncher in the next commit. |
We pick compiler based on file suffix, not directory, so it shouldn't matter where you put a .c file, it should always be compiled with gcc and .cpp files with g++. Which compiler is used to launch the linker can however differ. That's configured for each SetupNativeCompilation call with the different TOOLCHAIN settings. |
Erik, thank you for explanation. The launcher on Linux should not be linked with c++ runtime, that is why TOOLCHAIN_DEFAULT is used as a value for TOOLCHAIN property in BUILD_JPACKAGE_APPLAUNCHEREXE target on Linux. Will SetupNativeCompilation work if |
Mailing list message from erik.joelsson at oracle.com on build-dev: On 2021-02-01 10:38, Alexey Semenyuk wrote:
SetupNativeCompilation will by default include all src files found in /Erik |
Reworked the fix to avoid creation of extra source directories and file renames. |
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 like this much better, thanks for taking the time! Build changes look ok.
@alexeysemenyukoracle 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 124 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 |
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.
looks ok if build team approves
/integrate |
@alexeysemenyukoracle Since your change was applied there have been 127 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit fac3c2d. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Fix for https://bugs.openjdk.java.net/browse/JDK-8254702
The fix splits Linux app launcher in app launcher and launcher shared lib. App launcher is pure C and doesn't have C++ code. App launcher lib incorporates bulk of C++ code from app launcher.
At startup app launcher loads launcher shared lib and calls functions it provides to get data for launching JVM (path to jli lib and arguments for JLI_Launch function call).
App launcher unloads launcher shared lib before launching JVM to remove C++ runtime from the process memory.
Getting rid of C++ code from app launcher required to rewrite app installation location lookup code from C++ to C. LinuxPackage.c source is C alternative for https://github.com/openjdk/jdk/blob/master/src/jdk.jpackage/linux/native/applauncher/Package.cpp and https://github.com/openjdk/jdk/blob/master/src/jdk.jpackage/linux/native/applauncher/Executor.cpp.
Layout of jpackage's native code changed:
common
: code shared between all jpackage binaries.applauncher
: launcher only code.applauncherlib
: launcher lib code on Linux and launcher code on other platforms.applaunchercommon
: code shared between launcher and launcher lib on Linux and launcher code on other platforms.Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/2320/head:pull/2320
$ git checkout pull/2320