Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins do not stop properly #1850

Open
2 tasks done
zsoltkacsandi opened this issue Jun 25, 2024 · 0 comments
Open
2 tasks done

Plugins do not stop properly #1850

zsoltkacsandi opened this issue Jun 25, 2024 · 0 comments
Labels
bug Something isn't working no-stale Marks an issue so that it never goes stale.

Comments

@zsoltkacsandi
Copy link
Contributor

Description

Plugins executed via scanner/families/plugins/runner/runner.go do not exit properly in the following scenarios:

  • context deadline/cancellation
  • a panic occurs
  • termination of the scanner process (e.g. getting a SIGINT)

Resulting in zombie processes and stuck plugin containers:

Error response from daemon: Cannot kill container: 1428993dcd5f: container 1428993dcd5f PID 38877 is zombie and can not be killed. Use the --init option when creating containers to run an init inside the container that forwards signals and reaps processes

There are multiple reasons for this behaviour:

  • if the parent context is cancelled, the family manager returns and does not wait for the underlying goroutines to finish their execution
  • the Stop and Remove functions do not have a separate context, if the context passed from the CLI is cancelled, the cancellation propagates to these functions as well
  • panics are not handled

Expected Behavior

Plugins exit gracefully if something happens that deviates from the happy path.
Plugin containers are able to handle OS signals properly.

Steps to Reproduce

  1. Run the scanner CLI with a plugin enabled
  2. After the plugin has started running, terminate the main process, cause a panic, or cancel the context passed to the plugin runner

Checklist

@zsoltkacsandi zsoltkacsandi added bug Something isn't working no-stale Marks an issue so that it never goes stale. labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-stale Marks an issue so that it never goes stale.
Projects
None yet
Development

No branches or pull requests

1 participant