Skip to content

Stop the SDK workers and clients the worker service starts - #11436

Draft
prathyushpv wants to merge 1 commit into
mainfrom
ppv/worker-stop-sdk-workers
Draft

Stop the SDK workers and clients the worker service starts#11436
prathyushpv wants to merge 1 commit into
mainfrom
ppv/worker-stop-sdk-workers

Conversation

@prathyushpv

Copy link
Copy Markdown
Contributor

What changed?

parentclosepolicy.Processor and scanner.Scanner keep a reference to the SDK workers they start and stop them on shutdown. The batch activity closes the SDK client it creates per execution.

Why?

Neither component kept a reference before, so nothing could stop the workers and their pollers ran until the process exited. The batcher leaked a client reference per activity execution, so that one accumulated for the lifetime of a server process rather than per cluster.

Part of removing the TODO ignores in tests/leakcheck/leak_test.go (see #11322); these cover the baseWorker and basePoller entries.

How did you test it?

  • built
  • covered by existing tests
  • added new unit test(s)

New tests cover Processor.Stop, a failed start leaving nothing to stop, and the batch activity closing its client. Each was verified to fail when its fix is reverted.

The leak suite does not exercise these paths — scanner roles are disabled in its config and it runs no batch operations — so both rest on the unit tests rather than on make leak-test.

Potential risks

Scanner.Stop now stops up to six SDK workers sequentially, and each Stop issues a ShutdownWorker RPC. Shutdown order stops the worker service before the frontend, so this is bounded today, but it adds latency to worker-service shutdown where the frontend is already gone.

parentclosepolicy.Processor and scanner.Scanner dropped the reference to
every SDK worker they started, so nothing could stop them and their
pollers ran until the process exited. The batch activity created an SDK
client per execution and never closed it.
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.

1 participant