RFR(S): 8152947: VM crash with assert(!removed || is_in_use()) failed: unused osr nmethod should be invalidated
vladimir.x.ivanov at oracle.com
Tue Mar 29 15:42:08 UTC 2016
Does it still work when method() == NULL?
+ // Make sure osr nmethod is invalidated, i.e. not on the list
+ bool found = method()->method_holder()->remove_osr_nmethod(this);
+ assert(!found, "osr nmethod should have been invalidated");
On 3/29/16 6:28 PM, Tobias Hartmann wrote:
> Hi Dmitry,
> On 29.03.2016 15:05, Dmitry Dmitriev wrote:
>> Hi Tobias,
>> I think that "#ifdef ASSERT" must be instead of "#ifndef ASSERT" on lines 1338 and 1516. And it seems that the whole fix should be retested in this case.
> Oh, thanks for catching this!
> Here is the new webrev:
> I verified that this (still) fixes the problem and re-submitted the tests.
>> On 29.03.2016 15:01, Tobias Hartmann wrote:
>>> please review the following patch:
>>> JDK-8023191 added an assert to check if osr nmethods are invalidated (i.e. removed from the osr list). The assert is too strong because nmethod::invalidate_osr_method() may be executed by multiple threads that compete for making an osr nmethod not-entrant:
>>> Thread 1: Invalidates the osr nmethod and blocks just before executing the assert in line 1397.
>>> Thread 2: nmethod is already invalidated. Acquires patching lock and sets the nmethod to not-entrant.
>>> Thread 1: Continues execution and hits the assert because the nmethod was on the list and is (now) not-entrant.
>>> Thread 1 should ignore this and return. See also comment in nmethod::make_not_entrant_or_zombie():
>>> // another thread already performed this transition so nothing
>>> // to do, but return false to indicate this.
>>> I changed the verification code to check for osr invalidation *after* the state of the nmethod was set.
>>> Tested with failing test, JPRT and RBT (in progress).
More information about the hotspot-compiler-dev