Skip to content
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

IBM_JAVA_COMMAND_LINE environment variable not set #947

Open
pshipton opened this issue Jan 16, 2018 · 10 comments
Open

IBM_JAVA_COMMAND_LINE environment variable not set #947

pshipton opened this issue Jan 16, 2018 · 10 comments
Assignees
Milestone

Comments

@pshipton
Copy link
Member

pshipton commented Jan 16, 2018

I find references to the environment variable IBM_JAVA_COMMAND_LINE in OpenJ9 debugtools/DDR_VM, the openj9.dtfj module, rasdump/javadump.cpp, but OpenJ9 does not set this environment variable. I believe for IBM Java the IBM Java launcher would set it to the command line options specified. Since its not set for OpenJ9, the RAS code may not provide these command line details as intended.

@DanHeidinga
Copy link
Member

@fengxue-IS Can you take a look at this? At least to figure out what we need to do here.

@fengxue-IS
Copy link
Contributor

the original input is only available to the Java launcher, the best / near identical information can be reconstructed from the vm_args passed to JNI_CreatedJavaVM(), I am looking at rebuilding the input string in addLauncherArgs()

@DanHeidinga
Copy link
Member

Another option is to look at the OS and the info it provides:

This will get the exact commandline used to start the process, not just the version passed to the VM as some options get modified by the launcher

@fengxue-IS
Copy link
Contributor

tested with different approaches on all platforms,
Windows GetCommandLine works well,
AIX don't have command line stored under /proc/$PID/cmdline or a system call to retrieve that info
Linux systems have /proc/$PID/cmdline, though the file size is zero, so this have to be read/parsed in blocks
MacOS same as aix

for unix systems, this info can also be retrieved with ps -o [cmd|command] -ww $PID (requires shell command, not sure if this is a good idea)

@DanHeidinga
Copy link
Member

AIX don't have command line stored under /proc/$PID/cmdline or a system call to retrieve that info

@zl-wang Is there a way to get the command line from the OS on AIX? The /proc filesystem on linux provides this info and we need the equivalent on AIX.

(requires shell command, not sure if this is a good idea)

I agree this isn't a great idea. Let's see if we can find an alternative.

One option is to see if we can define an API for the Java launcher to support that provides this info. Might be worth a discussion with @andrew-m-leonard to see what can be added to the launcher.

@tajila
Copy link
Contributor

tajila commented Feb 3, 2022

@keithc-ca Can you please take a look at this?

@keithc-ca
Copy link
Contributor

Sure, I'll add it to the list.

@keithc-ca
Copy link
Contributor

For AIX, this looks promising: https://www.ibm.com/docs/en/aix/7.2?topic=g-getargs-subroutine.

@pshipton
Copy link
Member Author

pshipton commented Mar 3, 2022

All the pieces are merged and in 0.32, I expect this can be closed.

@pshipton
Copy link
Member Author

Re-opening due to #14766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants