On Tue, 9 May 2023 01:02:32 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> If the `thread` is no longer on any ThreadsList, then it is not safe to 
>> access `thread`.
>
> @dcubed-ojdk This is the current thread acting on itself

This method (i.e. `ThreadService::remove_thread()`) is called from 
`Threads::remove()` *after* the thread was removed from the thread list:

void Threads::remove(JavaThread* p, bool is_daemon) {
  ...
    // Maintain fast thread list
    ThreadsSMRSupport::remove_thread(p);
    ...
    ThreadService::remove_thread(p, is_daemon);


But if we reach here from `JavaThread::cleanup_failed_attach_current_thread()` 
as the comment implies (`JavaThread::cleanup_failed_attach_current_thread()` 
calls `Threads::remove()` in the case of an attach failure), calling 
`ThreadService::incr_exited_allocated_bytes()` is probably irrelevant, because 
a thread which failed to attach can't allocate anyway.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1188681748

Reply via email to