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

Forward SIGTERM and SIGINT down to java process in wrapper script #880

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sake
Copy link

@sake sake commented May 7, 2021

This patch adds trap handlers to the sh wrapper script, so that the Java process terminates when the sh process receives either SIGTERM or SIGINT.

I observed that the Java process kept running when the wrapper process gets killed by Ctrl-C or a signal sent over another way.
The trap handler makes sure that it forwards the signal to the Java child process, which does not happen otherwise in sh compatible shells.

The only drawback I see is that SIGKILL is not handled as it is not possible to intercept it.
As the python lib (https://github.com/AutomatedTester/browsermob-proxy-py) is using SIGKILL this unfortunately does not solve the problem there (AutomatedTester/browsermob-proxy-py#76).

An even simpler solution would be to just run the Java process with exec.
However in that case the JAVACMD check would have to happen before and it would need to be made without invoking the browsermod-proxy code.
So I decided that this would change less in the script.
I am happy to provide an alternative version if that is desireable.

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.

None yet

1 participant