On Mon, 17 Jun 2024 13:12:00 GMT, Inigo Mediavilla Saiz <d...@openjdk.org> 
wrote:

>> src/hotspot/share/runtime/threads.cpp line 1335:
>> 
>>> 1333:             const oop vt = p->vthread();
>>> 1334:             if (vt != thread_oop) {
>>> 1335:               assert(vt != nullptr, "vthread should not be null when 
>>> vthread is mounted");
>> 
>> I think the assert still belongs in the original position doesn't it? Or 
>> could the problem we hit here cause a transient null to appear as well?
>
> I think that, even if based on 
> [this](https://github.com/openjdk/jdk/pull/19482#issuecomment-2166116062) 
> comment from @AlanBateman's in some cases the virtual thread can be mounted 
> but `_vthread` can refer to the carrier thread, what you're saying is correct 
> and in both cases `_vthread` should still not be a null pointer:
> 
> - Either it's equal to `thread_oop` and we've already checked that it's not 
> `nullptr`.
> - Or it's different to `thread_oop` and it refers to an actual virtual thread 
> that should not be null.

I have moved the `assert` before the `if` in: 
9a954efe164d9caee31494773c0eecc8ff69223f

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19744#discussion_r1642808523

Reply via email to