Signal Handler Issue

Hi,

I'd like to ask how does the ETA API handles SIGTERM / SIGINT?

Whenever I have a SIGTERM, I figured that the "cleanupAndExit" will be triggered. However, after the cleanupAndExit, I can also see more log info about the "RSSL_RC_CET_CHANNEL_DOWN" under "channelEventCallback" which closes the connection and gives me following error.

16:41:26.931116 ERROR Connection down: Channel fd=11
16:41:26.931132 ERROR Error text: Reactor is shutting down.

Basically, can you explain what will happen after the program receives an signal?

Thanks!

Best Answer

  • Jirapongse
    Jirapongse admin
    Answer ✓

    @jerrymao

    I have verified the ETA code and found that ETA API doesn't register any handlers for SIGTERM and SIGINT. The ETA code is available in the package or GitHub. Therefore, by default, it will use the default action (terminating the process) to handle those signals.

    In your case, I assume that the application may register a handler for SIGTERM or SIGINT. Then, the thread that handles the SIGTERM or SIGINT is not the same thread that calls the channelEventCallback function. It could be a race condition between those threads.