Skip to content

Conversation

@zhan7236
Copy link

Summary

This PR addresses Issue #1389 by preventing auxiliary background worker processes from opening unnecessary network sockets during interconnect initialization.

Problem

Auxiliary background workers (ftsprobe, global deadlock detector, dtx recovery, sweeper, pg_cron launcher, ic proxy) were initializing the Motion Layer IPC, which opens network sockets for data exchange. Since these processes don't require interconnect communication, this behavior is unnecessary and can be considered a security concern.

Solution

Added a check for amAuxiliaryBgWorker() in both cdb_setup() and cdb_cleanup() functions to skip interconnect initialization and cleanup for auxiliary background workers.

Changes:

  • Modified src/backend/cdb/cdbutil.c:
    • Added !amAuxiliaryBgWorker() condition to cdb_setup() to skip InitMotionLayerIPC() call
    • Added !amAuxiliaryBgWorker() condition to cdb_cleanup() to skip CleanUpMotionLayerIPC() call
    • Applied to both #ifdef USE_INTERNAL_FTS and #else code paths

Testing

  • Code review verified correct syntax and logic
  • Header file postmaster/postmaster.h already included in cdbutil.c
  • Function amAuxiliaryBgWorker() properly declared in postmaster.h

Fixes #1389

@zhan7236 zhan7236 force-pushed the fix/aux-process-socket-issue-1389 branch from ef16f2b to f040fd4 Compare November 28, 2025 02:25
…kers

Fix issue apache#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.
@my-ship-it my-ship-it force-pushed the fix/aux-process-socket-issue-1389 branch from f040fd4 to db1a32c Compare November 28, 2025 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auxiliary process opens unnecessary network sockets

2 participants