-
Notifications
You must be signed in to change notification settings - Fork 729
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
Disable late attach to self by default #18
Conversation
@@ -102,6 +102,12 @@ | |||
private static String nameProperty; | |||
private static String pidProperty; | |||
private static int numberOfTargets; | |||
/*[IF Sidecar19-SE]*/ | |||
/*[PR 132828 don't allow VM to attach to itself unless explicitly enabled ]*/ |
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 is likely an internal ticket number - can you remove it and add any necessary context to the code or the PR?
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.
Fixed.
test/Java9andUp/playlist.xml
Outdated
|
||
<test> | ||
<featureIds> | ||
<featureId>113813</featureId> |
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.
What does this featureId mean?
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 is the Jazz work item for the refactoring of the Attach API.
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.
Please use an OpenJ9 issue number rather than a internal Jazz #.
I haven't looked at the test code yet - @smlambert can someone on your team take the lead on that? |
Can one of the admins verify this patch? |
2 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Escape analysis may have to create initialization code at the method start. If the first block is part of a loop, it will create a new block to hold these trees. However, the block test did not consider whether the first block was in an improper region, resulting in init code being placed inside a loop. Signed-off-by: Nicholas Coughlin <[email protected]>
Adds missing arguments for Java 9 compile to allow visibility to com.ibm.oti.util package. Adds fork=true argument to ensure compiler uses correct Java version and not Ant Java version These changes ensure the tests are compiled with the Java version we specified in the JAVA_BIN environment variable. Signed-off-by: Mike Zhang <[email protected]>
exc.initCause(e); | ||
throw exc; | ||
} | ||
|
||
if (descriptor.id().equals(AttachHandler.getVmId())) { | ||
/*[IF Sidecar19-SE]*/ | ||
String allowattachselfValue = AttachHandler.allowAttachSelf; |
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'm not a fan of this mixed all lower case with camelCase. Can this be named allowAttachSelfValue
for better readability?
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.
Done, though I inserted an underscore before "value" to indicate that it's the value of allowAttachSelf.
test/Java9andUp/playlist.xml
Outdated
|
||
<test> | ||
<featureIds> | ||
<featureId>113813</featureId> |
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.
Please use an OpenJ9 issue number rather than a internal Jazz #.
Properties props = vm.getSystemProperties(); | ||
props.list(System.out); | ||
} catch (AttachNotSupportedException e) { | ||
e.printStackTrace(); |
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.
Should the test be printing this unconditionally or should it be using an existing logger framework?
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.
SelfAttacher is run as a child process whose stdout and stderr are captured by the TargetManager which can log it, though I don't bother doing so in this test.
String myId = VmIdGetter.getVmId(); | ||
System.err.println("myId="+myId); | ||
boolean found = false; | ||
for (int i = 0; i <10 && !found; ++i) { |
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.
Is there no better way to get a VIrtualMachine id? Something without looping?
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.
Playlist: updated.
SelfAttacher:
This isn't to get the vmID. It's cycling waiting for the attach API to initialize. There is OpenJ9 internal API to do that, but it's not portable.
|
||
import org.testng.log4testng.Logger; | ||
|
||
/* This is was copied from org.openj9.test.attachAPI.TargetManager in Java8AndUp. |
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 was it copied? Is there a way to avoid duplicating the code?
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.
The original TargetManager is in Java8AndUp, which shares no OpenJ9 test code with Java9AndUp. Maybe @smlambert or @llxia can suggest a better mechanism.
return target; | ||
} | ||
|
||
static void listIpcDir() { |
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.
Can you add javadoc for each of these methods? It looks like this method tries to recursively list all the files and directories under the java.io.tmpdir to the logger.debug() output. Should it only be called if the logger.debug() level is enabled?
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.
Can you add javadoc for each of these methods?
Done. Let me know if you want more explanation.
It looks like this method tries to recursively list all the files and directories under the java.io.tmpdir to the logger.debug() output. Should it only be called if the logger.debug() level is enabled?
Actually, it lists the contents of /tmp/.com_ibm_tools_attach, which will be a few files for each Java process. This method is mostly for post-failure analysis.
errOutput += currentLine + "\n"; | ||
} | ||
} | ||
while (targetOutReader.ready()) { |
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 don't think this is the right code. I would expect a loop while readLine() is not returning null.
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.
As mentioned above, I don't want readline() to block.
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 don't think this actually stops readline from blocking - the stream is ready as soon as there are characters available.
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.
The readline() will block until there is a newline, but the target process emits complete lines, so any blocking will be brief. The purpose of the code was to handle the case where stdout would close and stderr was still open but not receiving anything.
} finally { | ||
try { | ||
/* get anything that may have been in the buffers */ | ||
while (targetErrReader.ready()) { |
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.
same as above and in other places using ready().
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.
See above.
* This test must be invoked via testng. Running the main method will return only the status of the attach API. | ||
* | ||
*/ | ||
@SuppressWarnings({"nls","boxing"}) |
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.
Please don't use SuppressWarnings.
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.
Okay.
@@ -0,0 +1,30 @@ | |||
/* Copyright (c) 2015, 2017 IBM Corp. and others |
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.
Can you explain the difference between src_latest and src_current? I'm not aware of why there are two...
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 is a kludge to handle the API differences between the two JCL versions in the builds.
also make sure all streams are closed Signed-off-by: Keith W. Campbell <[email protected]>
Attempt to work around timeouts cloning this repo in the CI builds by cloning less material. This is fine since the build doesn't commit back to that repo (or other repos for that matter) Issue eclipse-openj9#116 Signed-off-by: Dan Heidinga <[email protected]>
Prevent a JVM from late attaching to itself unless a system property is set either to "true" or an empty string, per the reference implementation. Enforce this in Java 9 only. Update existing tests to enable this feature by default so they will continue to run. Add new Java 9 tests to exercise this feature. Signed-off-by: Peter Bain <[email protected]>
Signed-off-by: Peter Bain <[email protected]>
747aa97
to
eb27b0e
Compare
…kout Use shallow clone of the openj9-openjdk-jdk9 repo in travis build
While resolving bootstrap method handles, TypeNotPresentException is currently thrown if a class is not found since we rely upon the MethodType API. But, NoClassDefFoundError should be thrown if a class is not found while resolving bootstrap method handles. This change translates TypeNotPresentException to NoClassDefFoundError while resolving bootstrap method handles. Signed-off-by: Babneet Singh <[email protected]>
Changes for OpenJ9 issue eclipse-openj9#126 Signed-off-by: Peter Bain <[email protected]>
Pushed the changes, not fully tested yet. |
Translate TypeNotPresentException to NoClassDefFoundError
Signed-off-by: Joe Dekoning <[email protected]>
During refactoring of the attach API, certain classes were being replaced due to legacy build scripts and needed to be replaced. This is no longer the case. Signed-off-by: Peter Bain <[email protected]>
Correct escape analysis loop check
update preprocessor builder and nature remove unnecessary builders and natures Signed-off-by: Keith W. Campbell <[email protected]>
…ription Update jcl project description
Remove tooling to restore original attach API code
Replace J9VM and JIT repo references with OpenJ9
Make IdleTuningGcOnIdle optimization is covered/included part of the option(Xtune:virtualized) which grouped the optimizations relevant for virtualized environment. Issue: eclipse-openj9#124 Signed-off-by: Parameswaran Selvam <[email protected]>
Signed-off-by: Ben Walsh <[email protected]>
Signed-off-by: Peter Bain <[email protected]>
Changes for OpenJ9 issue eclipse-openj9#126 Signed-off-by: Peter Bain <[email protected]>
Will open a new pull request for a single commit. |
In re Dan's comment above, no: git wouldn't let me rebase & squash, so I abandoned this pull request and created another. |
Adding the detailed build instructions for creating an OpenjDK V9 with OpenJ9 binary for Windows. Created as a completely separate section in the existing build instructions. No attempt to merge instructions for platforms yet. [ci skip] Work supports issue at ibmruntimes/openj9-openjdk-jdk9#18 Issue eclipse-openj9#18 Signed-off-by: Sue Chaplain <[email protected]>
Adding the detailed build instructions for creating an OpenjDK V9 with OpenJ9 binary for Windows. Created as a completely separate section in the existing build instructions. No attempt to merge instructions for platforms yet. [ci skip] Work supports issue at ibmruntimes/openj9-openjdk-jdk9#18 Issue eclipse-openj9#18 Signed-off-by: Sue Chaplain <[email protected]>
Compile error fix
Adding the detailed build instructions for creating an OpenjDK V9 with OpenJ9 binary for Windows. Created as a completely separate section in the existing build instructions. No attempt to merge instructions for platforms yet. [ci skip] Work supports issue at ibmruntimes/openj9-openjdk-jdk9#18 Issue eclipse-openj9#18 Signed-off-by: Sue Chaplain <[email protected]>
…pe-queries Switch to value type query methods from ClassEnv
Prevent a JVM from late attaching to itself unless a system property is set
either to "true" or an empty string, per the reference implementation. Enforce
this in Java 9 only. Update existing tests to enable this feature by default so
they will continue to run. Add new Java 9 tests to exercise this feature.
Fixes #126
Signed-off-by: Peter Bain [email protected]