RFR: 8259774: samplethreads option does not work for jfr thread sampler
Erik Gahlin
egahlin at openjdk.java.net
Fri Jan 15 04:28:04 UTC 2021
On Fri, 15 Jan 2021 02:28:21 GMT, Yang Yi <github.com+5010047+kelthuzadx at openjdk.org> wrote:
>> The samplethreads option was added in 7u40 as an easy way to disable method profiling.
>>
>> This was when the feature was new and we had spurious crashes when walking thread stacks. It allowed us to disable the features in our test infrastructure. We later fixed the issue. If we get a crash, we have a crash handlar that will allow us to continue. We kept the flag for a few releases, as a workaround for customers if they would run into issues. AFAIK, this has never been the case?
>>
>> The flag should really be removed. Could be it is still there because it has not yet gone through deprecation process.
>
> Thanks to your explanation, it makes sense. I have some ideas about this option. I noticed that the current implementation of thread sampling is to traverse threads from ThreadsList and do sampling. The consequence of this is that the sampling event in the recording file becomes very confusing, and it is difficult for users to find what they expect. If the user expects to know the callings of a certain thread in a period, this is impossible, because the sampling event of this thread is not continuous. So I wonder if there is a way for users to specify the thread they want to sample, for example:
> $ jstack
> // get thread id that expectes to know
> $ jcmd pid JFR.configure samplethreads=<tid>
There is no way to specify the thread.
It is possible to reduce the period to 1 ms to increase the number samples. It might help to troubleshoot the issue, but it will also create lots of additional events for all threads. We have thought about adding per thread capabilities, like filtering or recording all events for a particular thread, but the main obstacle has been how to configure such a system.
Plan is to simplify event configuration on command line and then see what features it will "unlock".
-------------
PR: https://git.openjdk.java.net/jdk/pull/2079
More information about the hotspot-jfr-dev
mailing list