RFR: 8252842: Extend jmap to support parallel heap dump

Chris Plummer cjplummer at openjdk.java.net
Wed Jan 27 20:02:40 UTC 2021


On Wed, 27 Jan 2021 19:21:35 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

>> Dear All, 
>> I have made a draft patch on parallel heap dump of jmap.  
>> This patch is still WIP with test case under development and code refining is in process.
>> 
>> But I want to firstly ask your help to discuss a potential compatibility issue that may need to solve:
>> 
>> This patch introduces a new "parallel" option to jmap, so after this patch, there can be at most 4 options for jmap that can be passed to JDK.
>>  
>> The issue is that there is a limitation in old version of jmap that at most 3 arguments can be accepted. As I commented in File JMap.java. and I can not simply enlarge the limitation to 4 because that will cause old version of jmap hang when working on new JDK.
>> 
>> So I use the 3rd argument of jmap to be a combined string and parse it to JDK, and the attachListener.cpp is modified to add the  logic for parsing it to get gzlevel and parallel thread number.
>> 
>> The current status is that, with current change in this patch, old jmap could work normally on new JDK, and new jmap without "parallel" could work correctly with old JDK.  
>> 
>> But the problem comes when new jmap use "gz=1, parallel=2" options together to communicate to an old JDK, the "gz" option takes no effect. The root cause is that old JDK's attachListener.cpp does not have the parsing logic, so it treat "gz=1, parallel=2" as a whole argument, and hence can not recognize it. 
>> 
>> May I ask your suggestion to see whether this is behavior is acceptable, and if not, any advice for fixing the compatibility issue? 
>> 
>> Thanks!
>> Lin
>
>> This patch introduces a new "parallel" option to jmap, so after this patch, there can be at most 4 options for jmap that can be passed to JDK.
>> 
>> The issue is that there is a limitation in old version of jmap that at most 3 arguments can be accepted. As I commented in File JMap.java. and I can not simply enlarge the limitation to 4 because that will cause old version of jmap hang when working on new JDK.
> 
> A year or so ago we ran into this same issue. I'll see if I can find the CR for it.

It looks like [JDK-8215622](https://bugs.openjdk.java.net/browse/JDK-8215622) introduced a 4th argument to the attach API, and this caused hangs when and older JVMs tried to attach. That was fixed by [JDK-8219721](https://bugs.openjdk.java.net/browse/JDK-8219721), and seemed to revert the arg count back to 3, although it's not too clear to me how this was accomplished. The webrev is here:

http://cr.openjdk.java.net/~xiaofeya/8219721/webrev.01/

Also at the same time the following was filed, which has not yet been addressed:

[JDK-8219896](https://bugs.openjdk.java.net/browse/JDK-8219896) Parameter size mismatch between client and VM sides of the Attach API

@linzang JDK-8215622 and JDK-8219721 were your CRs, so maybe you can elaborate on them a bit more.

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

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


More information about the serviceability-dev mailing list