RFR: 8224852: JVM crash on watched field access from native code [v3]

Leonid Mesnik lmesnik at openjdk.org
Wed Oct 22 05:28:38 UTC 2025


On Wed, 22 Oct 2025 05:03:12 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> Yes
>> The
>> jni_GetField_probe
>> is called on every field if any of fields access event is envabled.
>> 
>>   /* Keep JVMTI addition small and only check enabled flag here.       */ \
>>   if (JvmtiExport::should_post_field_access()) { \
>>     o = JvmtiExport::jni_GetField_probe(thread, obj, o, k, fieldID, false); \
>>   } \
>> 
>> The jni_GetField_probe checks if the events are enabled for this specific field on any thread for any jvmtiEnv and call
>> 
>> post_field_access_by_jni
>> 
>> which prepare all the data and call 
>> 
>> post_field_access
>> 
>> Only on this level it is check which threads and environments should post events. I suspect that it is done for unification of jni/non-jni check.
>> 
>>  So ```post_field_access_by_jni```  is executed for threads where events is not enabled.
>
> I see now, thanks! But then it means the comments are not easy to understand correctly. :)

I updated comments. Hope they are clearer now.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27584#discussion_r2450469704


More information about the serviceability-dev mailing list