From 175ff6598e014b2fe84c06fa443161294fc2eed0 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 5 Jan 2017 12:27:09 -0500 Subject: Fix possible crash reading pg_stat_activity. With the old code, a backend that read pg_stat_activity without ever having executed a parallel query might see a backend in the midst of executing one waiting on a DSA LWLock, resulting in a crash. The solution is for backends to register the tranche at startup time, not the first time a parallel query is executed. Report by Andreas Seltenreich. Patch by me, reviewed by Thomas Munro. --- src/backend/storage/lmgr/lwlock.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/backend/storage') diff --git a/src/backend/storage/lmgr/lwlock.c b/src/backend/storage/lmgr/lwlock.c index f4be4b4a7a6..1cf06848bb6 100644 --- a/src/backend/storage/lmgr/lwlock.c +++ b/src/backend/storage/lmgr/lwlock.c @@ -508,6 +508,8 @@ RegisterLWLockTranches(void) LWLockRegisterTranche(LWTRANCHE_LOCK_MANAGER, "lock_manager"); LWLockRegisterTranche(LWTRANCHE_PREDICATE_LOCK_MANAGER, "predicate_lock_manager"); + LWLockRegisterTranche(LWTRANCHE_PARALLEL_QUERY_DSA, + "parallel_query_dsa"); /* Register named tranches. */ for (i = 0; i < NamedLWLockTrancheRequests; i++) -- cgit v1.2.3