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

fix(python): process.terminate() got an unexpected keyword argument 'timeout' #2421

Merged
merged 1 commit into from
Jan 13, 2021

Conversation

RomainMuller
Copy link
Contributor

Corrected usage of process.terminate to remove unexpected timeout
argument. Not sure how this did not surface in integration tests (will
investigate later).

Fixes #2398


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@RomainMuller RomainMuller requested a review from a team January 13, 2021 13:13
@RomainMuller RomainMuller self-assigned this Jan 13, 2021
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 13, 2021
@RomainMuller RomainMuller force-pushed the rmuller/fix-python-temrinate branch from 97ae04d to a500444 Compare January 13, 2021 13:20
…timeout'

Corrected usage of `process.terminate` to remove unexpected `timeout`
argument. Not sure how this did not surface in integration tests (will
investigate later).

Fixes #2398
@RomainMuller RomainMuller force-pushed the rmuller/fix-python-temrinate branch from a500444 to 2d26a85 Compare January 13, 2021 13:23
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-5lHf64IXfvmr
  • Commit ID: 2d26a85
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

self._process.terminate(timeout=5)
except subprocess.TimeoutExpired:
self._process.kill()
self._process.terminate()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: terminate does the same work as kill, except on POSIX platforms, where the signal sent to the subprocess is different (SIGTERM for terminate, SIGKILL for kill). The default handling for both of these signals is the same (terminates the process).

SIGKILL cannot be trapped (always kills the process immediately, not giving it a chance to clean up after itself).

SIGTERM can be trapped (and rescued to not terminate the process), and gives the process a modest slice of time to clean up after itself. Since we are not trapping SIGTERM, both signals achieve the same - terminating the node VM, except SIGTERM would allow VM exit handlers to run, which is desirable.

@RomainMuller RomainMuller merged commit 2bac5fd into release Jan 13, 2021
@RomainMuller RomainMuller deleted the rmuller/fix-python-temrinate branch January 13, 2021 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants