[crac] RFR: Wake up all TIMED_WAITING threads after restore

Radim Vansa rvansa at openjdk.org
Tue Jun 20 06:46:36 UTC 2023

On Mon, 19 Jun 2023 15:26:37 GMT, Anton Kozlov <akozlov at openjdk.org> wrote:

>> This is a fix for an issue found by @jankratochvil when testing #53: Threads that enter sleep or timed parking use absolute monotonic time for pthread_cond_timedwait(). When the monotonic time changes during C/R we need to wake all threads to readjust the timeout to the new absolute time.
>> This introduces effectively a spurious wakeup; this is permitted for all the uses of pthread_cond_timedwait. Implementation either handles that transparently or propagates the wakeup to Java.
>> This commit does not handle timed waiting in non-Java threads other than WatcherThread.
> src/hotspot/os/linux/os_linux.cpp line 6124:
>> 6122:   assert(list != NULL, "Thread list is null");
>> 6123:   for (uint i = 0; i < list->length(); ++i) {
>> 6124:     JavaThread* t = list->thread_at(i);
> Please use Threads::threads_do, that includes non-Java threads as well.

Good point, I'll use `Threads::java_threads_do`. Not sure what I could do with non-Java threads, I haven't found any use of `pthread_cond_timedwait` from non-Java threads except the WatcherThread (and we can't fix non-JVM threads, we need to track any condition to signal).


PR Review Comment: https://git.openjdk.org/crac/pull/85#discussion_r1234807274

More information about the crac-dev mailing list