RFR: 8263565: NPE was thrown when sun.jvm.hotspot.rmi.serverNamePrefix was set
Yasumasa Suenaga
ysuenaga at openjdk.java.net
Tue Mar 16 00:20:07 UTC 2021
On Mon, 15 Mar 2021 18:47:15 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> NPE was thrown when I set server name prefix for debugd as following:
>>
>> $ jhsdb -J-Dsun.jvm.hotspot.rmi.serverNamePrefix=test debugd --pid 781
>> Attaching to process ID 781 and starting RMI services, please wait...
>> Error attaching to process or starting server: sun.jvm.hotspot.debugger.DebuggerException: java.lang.NullPointerException: Cannot invoke "String.length()" because "this.input" is null
>> at jdk.hotspot.agent/sun.jvm.hotspot.RMIHelper.rebind(RMIHelper.java:78)
>> at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.setupDebugger(HotSpotAgent.java:379)
>> at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:329)
>> at jdk.hotspot.agent/sun.jvm.hotspot.HotSpotAgent.startServer(HotSpotAgent.java:215)
>> at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runDEBUGD(SALauncher.java:431)
>> at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:493)
>> Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" because "this.input" is null
>> at java.base/java.net.URI$Parser.parse(URI.java:3166)
>> at java.base/java.net.URI.<init>(URI.java:623)
>> at java.rmi/java.rmi.Naming.intParseURL(Naming.java:273)
>> at java.rmi/java.rmi.Naming.parseURL(Naming.java:237)
>> at java.rmi/java.rmi.Naming.rebind(Naming.java:171)
>> at jdk.hotspot.agent/sun.jvm.hotspot.RMIHelper.rebind(RMIHelper.java:64)
>> ... 5 more
>>
>> `serverNamePrefix` would not affect due to trivial bug.
>
> The fix looks fine. It would be nice if this was documented somewhere (and even tested). Also, while looking into this I noticed the following comment:
>
> // debugServerID follows the pattern [unique_id@]host[:port]
> // we have to transform this as //host[:port]/<serverNamePrefix>['_'<unique_id>]
>
> The `[:port]` part is also not document, not even in the command line syntax for `sadebugd`
Thanks @plummercj for your review!
> The fix looks fine. It would be nice if this was documented somewhere (and even tested). Also, while looking into this I noticed the following comment:
>
> ```
> // debugServerID follows the pattern [unique_id@]host[:port]
> // we have to transform this as //host[:port]/<serverNamePrefix>['_'<unique_id>]
> ```
>
> The `[:port]` part is also not document, not even in the command line syntax for `sadebugd`
In addition `sun.jvm.hotspot.rmi.startRegistry` is also undocumented even though it works well.
Both `serverNamePrefix` and `startRegistry` are not exposed as command line options of jhsdb, I think documentation. implementing testcases, and exposing as command line options should be done simultaneously. We need to change both command line help and manpage in that work (CSR is needed of course.)
For example, I think we can expose them as following:
$ jhsdb debugd --help
:
--disableregistry Do not start RMI registry (to use RMI registry that exists)
--servernameprefix Specify RMI server name prefix
$ jhsdb jinfo --help
:
--connect [<id>@]<host>[:registryport][/servernameprefix] To connect to a remote debug server (debugd).
:
Examples: jhsdb jinfo --pid 1234
or jhsdb jinfo --core ./core.1234 --exe ./myexe
or jhsdb jinfo --connect debugserver
or jhsdb jinfo --connect id at debugserver:1234/prefix
I will work for it if you are ok.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3000
More information about the serviceability-dev
mailing list