From 199dd3ee6eddea7f5e6b5fb24183f78219296cb7 Mon Sep 17 00:00:00 2001 From: Sehrope Sarkuni Date: Wed, 10 Jun 2026 08:22:43 -0400 Subject: [PATCH 1/4] Fix CreateThread failure check in win32 timer code CreateThread returns NULL on failure, not INVALID_HANDLE_VALUE, so the error branch could never fire and a failed thread creation would silently disable all timer-based timeouts. --- src/backend/port/win32/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/port/win32/timer.c b/src/backend/port/win32/timer.c index 751327ef03e..16c2114c084 100644 --- a/src/backend/port/win32/timer.c +++ b/src/backend/port/win32/timer.c @@ -103,7 +103,7 @@ setitimer(int which, const struct itimerval *value, struct itimerval *ovalue) InitializeCriticalSection(&timerCommArea.crit_sec); timerThreadHandle = CreateThread(NULL, 0, pg_timer_thread, NULL, 0, NULL); - if (timerThreadHandle == INVALID_HANDLE_VALUE) + if (timerThreadHandle == NULL) ereport(FATAL, (errmsg_internal("could not create timer thread: error code %lu", GetLastError()))); -- 2.48.1