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(java): JsiiRuntime.ErrorStreamSink does not respond to being interrupted #2540

Merged
merged 6 commits into from
Feb 25, 2021

Conversation

RomainMuller
Copy link
Contributor

@RomainMuller RomainMuller commented Feb 5, 2021

Use zt-exec to launch the jsii-runtime process, as it offers better semantics
for IO redirection than Java's standard ProcessBuilder API (that it wraps). This
includes ways to pipe the standard outputs (in particular, STDERR) though a
line handler, which is exactly what we need to achieve in this particular case.

Since we no longer manage an error stream sink thread, we can hope that this
solves the issue of the thread not responding to interruptions correctly.

Fixes #2533


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

…rrupted

When the thread is interrupted, it should understand the VM is asking it to shut down,
and stop polling the child process' STDERR for more data. Previously, the thread did
not check Thread.interrupted(), and hence was ignoring requests to terminate, resulting
in ugly errors during clean-up.

This adds the necessary check for interrupt status, and stops the error sink as
asked by the VM.

Fixes #2533
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Feb 5, 2021
@RomainMuller RomainMuller requested a review from a team February 24, 2021 08:59
@RomainMuller RomainMuller added effort/small Small work item – less than a day of effort language/java Related to Java bindings module/runtime Issues affecting the `jsii-runtime` labels Feb 24, 2021
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-6Jw05QLuWWwe
  • Commit ID: 617febd
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

This was referenced Mar 17, 2021
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. effort/small Small work item – less than a day of effort language/java Related to Java bindings module/runtime Issues affecting the `jsii-runtime`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java: ErrorStreamSink does not clean itself up (invoked by mvn exec:java)
4 participants