Closed krismarc closed 2 years ago
So my question is if there's an option to disable attach api permanently on the java level without using bash hacks.
Can't -Dcom.ibm.tools.attach.enable=no
be specified as a command line option when running a java application? pls elaborate the usage scenario.
~On the other hand, adding the option into options.default
seems no affect~, will have a look.
Adding -Dcom.ibm.tools.attach.enable=no
into options.default
does prevent JVM to create .com_ibm_tools_attach
folder.
Be aware any other OpenJ9 VM w/o this option running at background which is going to create same folder silently.
@krismarc fyi
Hi @JasonFengJ9,
It worked. Thank you very much! I've seen this file (options.default). Not sure if I forgot to give it a try...
Just to answer your question. I want to prevent creation of those files whenever java is used on specific servers, so there might be many sources/applications which share the same java. Those are just defaults, so if it's really needed then the same can be explicitly enabled. It means your approach meets my goal :)
Best regards, K.M.
It's also possible to set options in an environment variable, which affects all JVMs that run in the environment. See https://www.eclipse.org/openj9/docs/cmdline_specifying/
Hi @pshipton that's so cool! Even better than using the file. Will survive even if somebody would reinstall the java.
TLDR for everyone else:
export OPENJ9_JAVA_OPTIONS="-Dcom.ibm.tools.attach.enable=no"
It works well for the top level, but if you have a process which creates a java process and doesn't carry forward the environment, there could be JVMs started that don't get the option.
Dear openj9 community,
within our organization Qualys complained about files generated by the Java in our temp directory. It creates files with world-wide permissions.
Basically, I found a solution -> https://www.eclipse.org/openj9/docs/attachapi/
However, without doing an ugly hack, I've got no idea how to enable following two args by default for the java itself. I tried some java.properties etc. without any success ☹ ..as a hack, I mean running Java binary with extra arguments added on the top of all other args. Like open-liberty does with it's java9.options file during the startup.
..where java1 is actual renamed java executable binary. This way files are not getting created at all.
HOW TO REPRODUCE:
..this would run java, check if directory exists and remove it.
..by doing the same with those arguments it's not reproducible anymore (files are not getting created - so there's nothing to be deleted).
So my question is if there's an option to disable attach api permanently on the java level without using bash hacks.
Best regards, K.M.