LuciferYang opened a new issue, #13678:
URL: https://github.com/apache/gravitino/issues/13678

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   `LocalJobExecutor.cancelJob` stops a running job with `Process.destroy()`, 
which sends SIGTERM, and then marks the job CANCELLING. Two things can go wrong 
after that.
   
   A job whose process ignores SIGTERM never exits. `runJob` keeps blocking in 
`process.waitFor()`, the job stays CANCELLING, and its worker thread is never 
released. The worker pool is fixed at `maxRunningJobs`, so each such job takes 
a slot for good; once every slot is held this way, new jobs stay queued until 
the server restarts.
   
   A job whose process traps SIGTERM and exits 0 is reported SUCCEEDED. 
`runJob` checks the exit code before it checks whether the job was being 
cancelled, so a clean exit taken in response to the cancel wins over the cancel.
   
   ### Error message and/or stacktrace
   
   No error is raised. In the first case the job stays CANCELLING indefinitely; 
in the second it ends SUCCEEDED instead of CANCELLED.
   
   ### How to reproduce
   
   1. Submit a shell job running `trap '' TERM; while :; do sleep 1; done`, 
wait until it is STARTED, and cancel it. It never leaves CANCELLING.
   2. Submit a shell job running `trap 'exit 0' TERM; while :; do sleep 1; 
done`, wait until it is STARTED, and cancel it. It ends SUCCEEDED.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to