diff --git a/src/backend/distributed/connection/shared_connection_stats.c b/src/backend/distributed/connection/shared_connection_stats.c index 82a354733..82ad26756 100644 --- a/src/backend/distributed/connection/shared_connection_stats.c +++ b/src/backend/distributed/connection/shared_connection_stats.c @@ -420,7 +420,7 @@ IncrementSharedConnectionCounter(const char *hostname, int port) { SharedConnStatsHashKey connKey; - if (GetMaxSharedPoolSize() == DISABLE_CONNECTION_THROTTLING) + if (MaxSharedPoolSize == DISABLE_CONNECTION_THROTTLING) { /* connection throttling disabled */ return; @@ -484,7 +484,11 @@ DecrementSharedConnectionCounter(const char *hostname, int port) { SharedConnStatsHashKey connKey; - if (GetMaxSharedPoolSize() == DISABLE_CONNECTION_THROTTLING) + /* + * Do not call GetMaxSharedPoolSize() here, since it may read from + * the catalog and we may be in the process exit handler. + */ + if (MaxSharedPoolSize == DISABLE_CONNECTION_THROTTLING) { /* connection throttling disabled */ return;