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

8263635: Add --servername option to jhsdb debugd #3669

Closed
wants to merge 7 commits into from

Conversation

YaSuenag
Copy link
Member

@YaSuenag YaSuenag commented Apr 25, 2021

jhsdb debugd supports server name prefix with sun.jvm.hotspot.rmi.serverNamePrefix system property. It will be used as remote name for SA RMI object. It is "SARemoteDebugger" by default.

As a result, remote name will be constructed as following:

//host[:port]/<serverNamePrefix>['_'<id>]

However we have no way to set it excepting system property. jhsdb should provide the way to set it as a command line option.

serverNamePrefix is used for RMI object name, so "server name" is more suitable for it. Thus I will add --servername to jhsdb debugd for this purpose.
And also we should add the way to specify it when we connect to debug server. I will add it like --connect id@server:1234/servername.

I've also filed CSR for this PR. Please review it.
This PR modifies DisableRegistryTest.java, but it has been addressed in ProblemList-zgc.txt now. So this PR does not affect ZGC.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3669/head:pull/3669
$ git checkout pull/3669

Update a local copy of the PR:
$ git checkout pull/3669
$ git pull https://git.openjdk.java.net/jdk pull/3669/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3669

View PR using the GUI difftool:
$ git pr show -t 3669

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3669.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 25, 2021

👋 Welcome back ysuenaga! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 25, 2021

@YaSuenag The following label will be automatically applied to this pull request:

  • serviceability

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.

@openjdk openjdk bot added the serviceability serviceability-dev@openjdk.org label Apr 25, 2021
@YaSuenag YaSuenag marked this pull request as ready for review April 25, 2021 07:29
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 25, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 25, 2021

Webrevs

@YaSuenag
Copy link
Member Author

YaSuenag commented May 4, 2021

Ping: Could you review this PR and CSR ? Thanks!

@sspitsyn
Copy link
Contributor

sspitsyn commented May 5, 2021

I've looked at the CSR and added a comment with a question.

@YaSuenag
Copy link
Member Author

YaSuenag commented May 5, 2021

/csr needed

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label May 5, 2021
@openjdk
Copy link

openjdk bot commented May 5, 2021

@YaSuenag this pull request will not be integrated until the CSR request JDK-8265897 for issue JDK-8263635 has been approved.

@YaSuenag
Copy link
Member Author

@sspitsyn Thanks for your comment!
I updated the CSR, and pushed new commits to follow it. Could you review again?

@@ -88,24 +90,18 @@ public static void unbind(String uniqueID) throws DebuggerException {
}

public static Remote lookup(String debugServerID) throws DebuggerException {
// debugServerID follows the pattern [unique_id@]host[:port]
// debugServerID follows the pattern [unique_id@]host[:port][/prefix]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit unclear to me why we need both a "unique_id" and a "prefix". I understand that the SA already append the two, and that previously the prefix was a constant, but I don't see why the user would ever need to set the "prefix" when they can always specify a "unique_id" that is truly unique. What is the use case for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"prefix" is similar to "unique_id" as you said, but it is useful to group debugees.

For example, the host runs 2 container pods as following:

  • Pod A
    • Container 1
    • Container 2
    • Container 3
  • Pod B
    • Container 1
    • Container 2
    • Container 3

If we want to compare 2 pods with jhsdb, we can set ID like "A-1", "B-1".
However, if the prefix is supported on jhsdb, we can set ID and prefix like "1@localhost/A", "1@localhost/B". I think it is easy to understand.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this explanation seems reasonable, but is not something that is really conveyed with the the name --prefix or with the help "Sets the prefix to distinguish SA debugee". We are at the same giving too much and too little info. Too much in that we are saying that it is a prefix of some sort, which then leads to that fact that we don't explain how it is used in the RMI URL.

I'm not saying that we need to explain how the --connect [<id>@]<host>[:registryport][/prefix] option is converted into an RMI URL (although perhaps we should), but it seems we at least need to describe the relation between <id> and /prefix. Otherwise no one is really going to understand how/why to use it.

Also, having the prefix at the end of the "serverID" string seems odd. Maybe it should be:

[[prefix/]unique_id@]host[:port]

Copy link
Member Author

@YaSuenag YaSuenag May 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, all parameters will be transformed to //host[:port]/<serverNamePrefix>['_'<unique_id>].
--prefix and id affect to RMI object name to be precise. So ID is object name, then the prefix will be added to it.

Based on them, how about this?

--prefix <url prefix> Set the prefix to add to debug server instance name.

I understand is is odd the value is added to the tail even if it is named "prefix".
Both prefix and id are optional, so we can specify prefix only, then prefix/@host is strange for me.

How about this pattern? Use ":" instead of "/" like a URL.

[prefix:][unique_id@]host[:port]

I thought to give new name instead of "prefix", but I give up because I have not good idea and would be inconsistent system property. (sun.jvm.hotspot.rmi.serverNamePrefix)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is better, but I think better help output is needed. prefix has a default and unique_id does not. I think both of these need to be mentioned in the help output. Also, if unique_id is not specified, then the value of prefix is the name of the RMI object, which seems a bit odd because it is suppose to be a prefix to a name, not the entire name.

I think maybe the property name of sun.jvm.hotspot.rmi.serverNamePrefix was not a good choice, and is making it harder to come up with good argument names and syntax. If designing this from scratch, I would have called it sun.jvm.hotspot.rmi.serverName, and then appending an optional unique_id to it would make more sense.

What if instead of prefix you used servername and possibly also rename sun.jvm.hotspot.rmi.serverNamePrefix to sun.jvm.hotspot.rmi.serverName, but also keep legacy support in case someone is already using sun.jvm.hotspot.rmi.serverNamePrefix and decides to set it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe the property name of sun.jvm.hotspot.rmi.serverNamePrefix was not a good choice, and is making it harder to come up with good argument names and syntax. If designing this from scratch, I would have called it sun.jvm.hotspot.rmi.serverName, and then appending an optional unique_id to it would make more sense.

Agree.

What if instead of prefix you used servername and possibly also rename sun.jvm.hotspot.rmi.serverNamePrefix to sun.jvm.hotspot.rmi.serverName, but also keep legacy support in case someone is already using sun.jvm.hotspot.rmi.serverNamePrefix and decides to set it?

Sounds good if we can do so! Indeed we need to send CSR for this issue, so we can do it.
We do not need to think to pass parameters via system properties because we have SALauncher. So I think against this issue as following. Is it ok?

  • Add --servername option to debugd
    • debugd help describes about this as "instance name of debugd server"
    • man page of jhsdb describes that it is used for RMI object name, and describes "SARemoteDebugger" is set by default.
  • Connection string is [unique_id@]host[:port][/servername]
  • Change the description for --serverid in man page to "This is required if multiple debug servers are run on the same server instance. It would be added to RMI object name for server instance."
    • Will not change the help message because it seems to be enough to describe abstraction (A unique identifier for this debug server)
  • Declare that sun.jvm.hotspot.rmi.serverNamePrefix will be deprecated in the CSR, and show the warning if it is set

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a CSR. I think it can cover both the addition of --servername and the rename of serverNamePrefix.

We need to be more consistent with the use of serverid. Between the man page, help output, and code we call use serverid, <id> and uniqueID. We should use serverid in all cases.

@YaSuenag YaSuenag changed the title 8263635: Add --prefix option to jhsdb debugd 8263635: Add --servername option to jhsdb debugd May 15, 2021
@YaSuenag
Copy link
Member Author

@plummercj I updated the CSR and JBS issue to rename to --servername, and also I pushed new commit to follow them. It includes the update for help message, man page, and variable names.

String serverNamePrefix = System.getProperty("sun.jvm.hotspot.rmi.serverNamePrefix");
if (serverNamePrefix != null) {
System.err.println("WARNING: sun.jvm.hotspot.rmi.serverNamePrefix is deprecated. Please specify it in --connect.");
rmiObjectName = serverNamePrefix;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the servername was already specified with --connect, I would think that we would not want to override it with the property if it is also set. Maybe if both are set then fail with an error. Same in getName() below.

@@ -104,6 +102,7 @@ private static boolean debugdHelp() {
" be a hostname or an IPv4/IPv6 address. This option overrides the system property" +
" 'java.rmi.server.hostname'. If not specified, the system property is used. If the system" +
" property is not set, a system hostname is used.");
System.out.println(" --servername <name> Instance name of debugd server.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should go right below --serverid above

}
return false;
}

private static boolean debugdHelp() {
// [options] <pid> [server-id]
// [options] <executable> <core> [server-id]
System.out.println(" --serverid <id> A unique identifier for this debug server.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"debugd server" instead of "debug server"

.B \f[CB]\-\-servername\f[R] \f[I]servername\f[R]
Sets the instance name of debugd server to distinguish SA debugee.
It is used for RMI object name for server instance.
If not specified, "SARemoteDebugger" will be set.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"will be used"

@YaSuenag
Copy link
Member Author

@plummercj Thanks for your review! I pushed new commit to fix them. And also I updated debugd help message in CSR.

System.err.println("WARNING: sun.jvm.hotspot.rmi.serverNamePrefix is deprecated. Please specify it with --servername.");
name = serverNamePrefix;
} else {
throw new DebuggerException("Cannot set both sun.jvm.hotspot.rmi.serverNamePrefix and in --servername together");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove "in"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I fixed it in new commit.

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Yasumasa,

It looks good to me.

Thanks,
Serguei

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label May 26, 2021
@openjdk
Copy link

openjdk bot commented May 26, 2021

@YaSuenag 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:

8263635: Add --servername option to jhsdb debugd

Reviewed-by: cjplummer, sspitsyn

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 220 new commits pushed to the master branch:

  • b33b8bc: 8267750: Incomplete fix for JDK-8267683
  • ac36b7d: 8267452: Delegate forEachRemaining in Spliterators.iterator()
  • d0d2ddc: 8267651: runtime/handshake/HandshakeTimeoutTest.java times out when dumping core
  • a98e476: 8267311: vmTestbase/gc/gctests/StringInternGC/StringInternGC.java eventually OOMEs
  • 5aa45f2: 8267403: tools/jpackage/share/FileAssociationsTest.java#id0 failed with "Error: Bundler "Mac PKG Package" (pkg) failed to produce a package"
  • c20ca42: 8267691: Change table to obsolete CriticalJNINatives in JDK 18, not 17
  • e751b7b: 8267683: rfc7301Grease8F value not displayed correctly in SSLParameters javadoc
  • 0b77359: 8224243: Add implSpec's to AccessibleObject and seal Executable
  • 594d454: 8267574: Dead code in HtmlStyle/HtmlDocletWriter
  • 2ef2450: 8263445: Duplicate key compiler.err.expected.module in compiler.properties
  • ... and 210 more: https://git.openjdk.java.net/jdk/compare/9713152eae660f83b8a681c3168b7eb2285c05bc...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 26, 2021
@YaSuenag
Copy link
Member Author

/integrate

@openjdk openjdk bot closed this May 27, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 27, 2021
@openjdk
Copy link

openjdk bot commented May 27, 2021

@YaSuenag Since your change was applied there have been 237 commits pushed to the master branch:

  • 6ffa3e6: 8267754: cds/appcds/loaderConstraints/LoaderConstraintsTest.java fails on x86_32 due to customized class loader is not supported
  • 1899f02: 8267805: Add UseVtableBasedCHA to the list of JVM flags known to jtreg
  • 0fc7c8d: 8267751: (test) jtreg.SkippedException has no serial VersionUID
  • a859d87: 8267721: Enable sun/security/pkcs11 tests for Amazon Linux 2 AArch64
  • e630235: 8266851: Implement JEP 403: Strongly Encapsulate JDK Internals
  • 8c4719a: 8265248: Implementation Specific Properties: change prefix, plus add existing properties
  • c59484e: 8267653: Remove Mutex::_safepoint_check_sometimes
  • de91643: 8267611: Print more info when pointer_delta assert fails
  • a4c46e1: 8263202: Update Hebrew/Indonesian/Yiddish ISO 639 language codes to current
  • 9c346a1: 8266963: Remove safepoint poll introduced in 8262443 due to reentrance issue
  • ... and 227 more: https://git.openjdk.java.net/jdk/compare/9713152eae660f83b8a681c3168b7eb2285c05bc...master

Your commit was automatically rebased without conflicts.

Pushed as commit 37bc4e2.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@YaSuenag YaSuenag deleted the JDK-8263635 branch May 27, 2021 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
3 participants