Public bug reported:

when using "normal exit 0 SIGTERM" in a job, and if the job is killed with 
SIGTERM, a warning message will appear in dmesg, like
[330159.038611] init: xxxyyyzzz main process (570) killed by TERM signal

If using "normal exit 0 SIGTERM 15" instead, there won't be such warning
message when the job is killed with SIGTERM, 15 is the numerical value
for SIGTERM, per "man 7 signal"

After reading the code, it looks to me that the issue is:
1. when parsing "normal exit 0 SIGTERM", the numerical value of SIGTERM is left 
shifted by 8 and then stored in job->class->normalexit
http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/parse_job.c#L2433
2. but when determining the appropriate log level, the value in 
job->class->normalexit is compared directly to numerical value of the signal, 
(without left shift the signal value)
http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/job_process.c#L1495

When using "normal exit 0 SIGTERM 15", both "15 << 8" and 15 will be stored in 
job->class->normalexit, the code to store 15 is at
http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/init/parse_job.c#L2428
and thus later on the code to determine log level works.

Note that "normal exit 0 SIGTERM" works well with "respawn", it is just
the logging code has the minor bug said above.

** Affects: upstart (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1515060

Title:
  Wrong logging level when signal name (e.g., SIGTERM) is used with
  normal exit stanza

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/1515060/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to