RFR: 8263635: Add --prefix option to jhsdb debugd [v2]

Chris Plummer cjplummer at openjdk.java.net
Wed May 12 23:05:52 UTC 2021


On Tue, 11 May 2021 01:34:16 GMT, Yasumasa Suenaga <ysuenaga at openjdk.org> wrote:

>> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/RMIHelper.java line 93:
>> 
>>> 91: 
>>> 92:     public static Remote lookup(String debugServerID) throws DebuggerException {
>>> 93:         // debugServerID follows the pattern [unique_id@]host[:port][/prefix]
>> 
>> 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?
>
> "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 at localhost/A", "1 at localhost/B". I think it is easy to understand.

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]

-------------

PR: https://git.openjdk.java.net/jdk/pull/3669


More information about the serviceability-dev mailing list