This is an automated email from the ASF dual-hosted git repository.

gfphoenix78 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/main by this push:
     new 9210269d944 fix(backend): Skip cdb_setup/cdb_cleanup for auxiliary 
background workers
9210269d944 is described below

commit 9210269d944fd5aacdf516d201bcfa813121ce19
Author: zhan7236 <[email protected]>
AuthorDate: Thu Nov 27 15:33:20 2025 +0000

    fix(backend): Skip cdb_setup/cdb_cleanup for auxiliary background workers
    
    Fix issue #1389: Auxiliary processes (ftsprobe, global deadlock detector,
    dtx recovery, sweeper, pg_cron launcher) currently open unnecessary
    network sockets for interconnect communication they don't need.
    
    Per review feedback, instead of adding checks inside cdb_setup/cdb_cleanup
    functions, skip calling these functions entirely for auxiliary background
    workers in InitPostgres().
    
    This resolves the security concern of having unnecessary open network
    ports and reduces resource usage.
---
 src/backend/utils/init/postinit.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/init/postinit.c 
b/src/backend/utils/init/postinit.c
index e84c0efb77e..34bdf7364d4 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -1267,8 +1267,14 @@ InitPostgres(const char *in_dbname, Oid dboid, const 
char *username,
      * Primary function is to establish connections to the qExecs.
      * This is SKIPPED when the database is in bootstrap mode or 
      * Is not UnderPostmaster.
+     *
+     * Also skip for auxiliary background workers (e.g., ftsprobe, global
+     * deadlock detector, dtx recovery, sweeper, pg_cron launcher). These
+     * processes don't require interconnect for data exchange and opening
+     * unnecessary network sockets may be considered a security issue.
      */
-    if (!bootstrap && IsUnderPostmaster && !IsLoginMonitorWorkerProcess())
+    if (!bootstrap && IsUnderPostmaster && !IsLoginMonitorWorkerProcess() &&
+        !amAuxiliaryBgWorker())
     {
                cdb_setup();
                on_proc_exit( cdb_cleanup, 0 );


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to