Hi Lin, My proposal is a just idea, so you need to tweak it.
AttachListener receives raw command. For example, jcmd is `jcmd\0<arg strings>`. Please see HotSpotVirtualMachine and extended classes. In case of jcmd, I guess AttachListener will receive message `<version>\0jcmd\0<args>\0\0\0` (I did not check it well). So I guess we can add '\0' when `str_count` does not reach to maximum. Thanks, Yasumasa On 2019/02/27 11:50, zangl...@jd.com wrote:
Dear Yasumasa, The fix you mentioned seems not work as expected. I have done an experiment that use jdk1.8's "jcmd <pid> help" to attach to latest jdk. it seem the whole "jcmd <pid> help" buffer is not read completely at one time. in my case it is "jcmd", "<pid>", "help", and then block at while(). After applied your change, it seems only the "jcmd" is processed, the "<pid>", "help" is replaced by '\0'. BRs, Lin