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

Cancel job on client TERM signal #1112

Open
mbien opened this issue Aug 26, 2024 · 3 comments
Open

Cancel job on client TERM signal #1112

mbien opened this issue Aug 26, 2024 · 3 comments

Comments

@mbien
Copy link
Member

mbien commented Aug 26, 2024

Hello!

the client is cancelling jobs on ctrl+c which makes sense. However, it seems like it won't do anything on TERM signal.

This makes it difficult for tools which treat mvn and mvnd the same to stop jobs, e.g (apache/netbeans#7676).

This would be trivial to solve with a shutdown hook, but while playing with this, some problems occurred:

here is a prototype which:

  • adds a JVM shutdown hook which sends the cancel msg on irregular shutdown (SIGTERM)
  • this requires to build the native image with --install-exit-handlers, since without it, GraalVM would not trigger shutdown hooks on irregular shutdowns

The problem however is that the build is also setting -H:-ParseRuntimeOptions for the purpose of delegating -D params instead of parsing them as args. This seems to mess with the signal chaining and prevents the shutdown hook from running again.

This almost looks like a graalvm bug to me - but I am not sure. Maybe someone here has more experience with this scenario. (I tried graalvm 22.0.2 and also some older releases).

If the mvnd team thinks this is the right direction I would try to investigate a bit further if this is a graalvm bug or not.

(There are also many ways how to solve this from the side of NetBeans, it could send "ctrl+c" first, however there is probably no way to know how long to wait before sending TERM if nothing happens. Or it could talk to the daemon itself. I think it would be more elegant if both mvn and mvnd would be treated the same though in terms of shutdown.)

@cstamas
Copy link
Member

cstamas commented Aug 26, 2024

@gnodet @ppalaga please chime in!

@gnodet
Copy link
Contributor

gnodet commented Aug 26, 2024

@mbien your proposal sounds legit to me. I must admit my GraalVM experience is mostly limited to mvnd, so I won't be able to help much on that side.

@mbien
Copy link
Member Author

mbien commented Aug 26, 2024

thanks! I could reproduce it outside of mvnd and filed a bug upstream oracle/graal#9568

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

No branches or pull requests

3 participants