Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

We use our Java application under X that starts from /etc/X11/Xsessions.d/9999ngoma

root@denis-laptop:~# uname -a
Linux denis-laptop 2.6.32-36-generic #79-Ubuntu SMP Tue Nov 8 22:29:26 UTC 2011 i686 GNU/Linux

It starts as a full-screen replacement of GDM. When the system is powered down, it seems our app receives SIGKILL and not SIGTERM (this is the reason some resources are not stored to disk).

How could this happen?

I should also warn once again, that application starts exclusively fom, /etc/X11/Xsessions.d/9999ngoma. Exclusively means that Gnome is loaded only after our application exits (I just don't know other way to run application exclusively under X). Could it be that GDM receives SIGTERM and then SIGKILL child that didn't finish during GDM session initialization process (script at Xsession.d directory).

share|improve this question

migrated from serverfault.com Dec 20 '11 at 17:26

This question came from our site for professional system and network administrators.

    
Are you sure your application is not ignoring SIGTERM? –  enzotib Dec 20 '11 at 20:18
7  
Normally your application would receive SIGTERM and would have a short time window (a few seconds, but shared with any other application that's competing for wall clock time) to respond. Are you sure your application isn't reacting too slowly to the SIGTERM and getting a SIGKILL before it's finished saving? You should save as soon as settings change; that way your data would always be stored on the disk, even if the whole system crashes. –  Gilles Dec 20 '11 at 23:33
    
Well, seems that applies to UBUNTU only. This guy is claiming the same (ubuntuforums.org/showthread.php?t=944727). I tested in on 2 computers, my shutdown hook does not execute for sure. Could it be that UBNUTU does not send SIGTERM, or Xorg does not SIGTERM child processes, but SIGKILL them? –  archer Dec 21 '11 at 10:13
add comment

1 Answer 1

It's possible that the app, its parent process, or any of its parent has set the SIGTERM signal to be ignored. This setting is inherited across calls to fork() and persists across exec().

You can diagnose this further by using strace(1) on the various processes and manually sending them a SIGTERM. If the strace output shows the signal being received, they're not ignoring it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.