ossf / ossf/package-analysis

[worker] gracefully terminate when a SIGTERM is received

Open
#376 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
Go
Stars
912
Forks
74
PR merge metrics
No merged PRs in 30d

Description

The analysis worker in Kubernetes is sent a SIGTERM, and then 30 seconds later a SIGKILL.

I would be great if the analysis worker should gracefully stop working when it receives the SIGTERM.

Ideally this should be done with an algorithm like the following:

  • don't start any new work if we've just finished
  • wait a grace period (e.g. 5-10 seconds) to see if the current work finishes successfully
  • use Go's context support to cancel a context after this grace period - if the analysis detects the context is cancelled it should immediately tear down the sandbox and abort execution without storing a result

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Go analysis worker's work loop, SIGTERM handling, and existing context propagation. Verify how current work and sandbox teardown are managed; done means the worker stops accepting new work, allows a grace period, cancels the context, aborts execution without storing a result, and exits before Kubernetes sends SIGKILL.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
backend, devops
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.