adoroszlai opened a new pull request, #7006:
URL: https://github.com/apache/ozone/pull/7006

   ## What changes were proposed in this pull request?
   
   1. Move `SignalLogger` to `hdds-server-framework` from `hdds-common`, as it 
is only used by servers, not clients.
   2. Replace usage of `sun.misc.Signal` with `jnr-posix`.
   
   Key detail missed in previous attempt (#6876) is to invoke the default 
signal handler (which exits the process).  `jnr-posix` currently does not 
return the default handler, so we need to explicitly call `System.exit` as a 
workaround.
   
   https://issues.apache.org/jira/browse/HDDS-11078
   
   ## How was this patch tested?
   
   Tested with real process on Linux:
   
   ```
   $ cd hadoop-ozone/dist/target/ozone-1.5.0-SNAPSHOT
   $ bin/ozone s3g
   ...
   [main] INFO s3.Gateway: registered UNIX signal handlers for [SIGHUP, SIGINT, 
SIGTERM]
   ...
   [main] INFO http.BaseHttpServer: HTTP server of s3gateway listening at 
http://0.0.0.0:9878
   ```
   
   Sent signal from other terminal:
   
   ```
   $ kill -SIGTERM $(ps x | grep 'proc_s3[g]' | awk '{ print $1 }')
   
   [SIGTERM handler] ERROR s3.Gateway: RECEIVED SIGNAL 15: SIGTERM
   [shutdown-hook-0] INFO s3.Gateway: SHUTDOWN_MSG: 
   /************************************************************
   SHUTDOWN_MSG: Shutting down Gateway at ...
   ************************************************************/
   [shutdown-hook-0] INFO s3.Gateway: Stopping Ozone S3 gateway
   ...
   [JvmPauseMonitor0] INFO util.JvmPauseMonitor: JvmPauseMonitor-S3G: Stopped
   ```
   
   Also with other signals (after restart):
   
   ```
   $ kill -SIGINT $(ps x | grep 'proc_s3[g]' | awk '{ print $1 }')
   
   [SIGINT handler] ERROR s3.Gateway: RECEIVED SIGNAL 2: SIGINT
   (same output)
   ```
   
   ```
   $ kill -SIGHUP $(ps x | grep 'proc_s3[g]' | awk '{ print $1 }')
   
   [SIGHUP handler] ERROR s3.Gateway: RECEIVED SIGNAL 1: SIGHUP
   (same output)
   ```


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to