RFR: 8365407: Race condition in MethodTrainingData::verify() [v8]

Igor Veresov iveresov at openjdk.org
Tue Sep 2 16:19:45 UTC 2025


On Tue, 2 Sep 2025 16:15:42 GMT, Igor Veresov <iveresov at openjdk.org> wrote:

>> src/hotspot/share/oops/trainingData.cpp line 635:
>> 
>>> 633:     int init_deps_left2 = compute_init_deps_left();
>>> 634: 
>>> 635:     bool invariant = (init_deps_left1 >= init_deps_left2);
>> 
>> I assume this check takes concurrent class initialization into account and init notification events are processed on a dedicated thread. Can we strengthen the check by repeatedly performing it and ensuring the value converges? Also, maybe take event queue into account?
>
> It's very hard to do reliably given the way the vm shutdown currently works. There is no way to ensure that all the java threads are stopped, so checking the convergence is problematic. So, the best I can do right now is prove the `>=` property.

I mean, I tired, but gave up on the convergence for now. Perhaps we'd make a stab at it another time.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26866#discussion_r2316577781


More information about the hotspot-dev mailing list