Skip to content

Fix URMA polling shutdown lifetime - #3634

Open
BGQ99 wants to merge 8 commits into
apache:masterfrom
LinQuickDev:fix/urma-polling-shutdown
Open

BGQ99 wants to merge 8 commits into
apache:masterfrom
LinQuickDev:fix/urma-polling-shutdown

Conversation

@BGQ99

@BGQ99 BGQ99 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: Related to #3428

Problem Summary:

The normal process-exit path lacks a dedicated stop-and-join handler for URMA
polling workers, while poller groups are stored in an ordinary static vector.
Late Socket/UrmaEndpoint cleanup may enqueue CQ removal operations after the
poller queues have been destroyed.

What is changed and the side effects?

Changed:

  • Keep the poller-group vector alive for the process lifetime using a leaky singleton.
  • Register a polling-only atexit handler to stop and join polling workers, preserving the existing IOBuf pool lifetime because thread-local blocks may outlive atexit handlers.
  • Skip CQ add/remove operations when the group is no longer running.
  • Add regression tests for polling shutdown and process exit.

Validation (URMA mock):

  • CMake build passed with WITH_URMA=ON and URMA_USE_MOCK=ON.
  • All 20 tests passed.
  • An exit probe confirmed that polling workers completed their release callbacks before normal process exit.
  • git diff --check passed.

Side effects:

  • Performance effects: adds a running-state check to CQ registration/removal; the CQ polling loop is unchanged.

  • Breaking backward compatibility: no wire protocol or existing function signature changes. The poller-group container is intentionally retained until process termination.


Check List: