Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

[SOLVED] Why Does OpenRC Send Many Identical Signals

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
3 posts • Page 1 of 1
Author
Message
jagdpanther
l33t
l33t
Posts: 820
Joined: Sat Nov 22, 2003 2:26 pm

[SOLVED] Why Does OpenRC Send Many Identical Signals

  • Quote

Post by jagdpanther » Mon Jul 09, 2018 2:20 pm

Why does OpenRC send many identical signals to stop a process?

For example:

Code: Select all

 # /etc/init.d/clamd restart
 * Executing: /lib64/rc/sh/openrc-run.sh /lib64/rc/sh/openrc-run.sh /etc/init.d/clamd stop
 * Stopping clamd ...
 * Will stop clamd
 * Sending signal 15 to PID 4222 ...                                                          [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Sending signal 0 to PID 4222 ...                                                           [ ok ]
 * Stopping freshclam ...
 * Will stop freshclam
 * Sending signal 15 to PID 4230 ...                                                          [ ok ]
 * Executing: /lib64/rc/sh/openrc-run.sh /lib64/rc/sh/openrc-run.sh /etc/init.d/clamd start
 * Starting clamd ...
 * Detaching to start `/usr/sbin/clamd' ...                                                   [ ok ]
 * Starting freshclam ...
 * Detaching to start `/usr/bin/freshclam' ...                                                [ ok ] 
I notice happens many times with different services when shutting down or rebooting.

Is this something that can be controlled or limited to onece per second?
Last edited by jagdpanther on Mon Jul 09, 2018 4:20 pm, edited 1 time in total.
Top
Atom2
Apprentice
Apprentice
Posts: 185
Joined: Mon Aug 01, 2011 9:16 am

Re: Why Does OpenRC Send Many Identical Signals

  • Quote

Post by Atom2 » Mon Jul 09, 2018 4:04 pm

Hi jagdpanther,
jagdpanther wrote:Why does OpenRC send many identical signals to stop a process?
Actually it does not. It goes like this: OpenRC sends signal 15 - which is SIGTERM - to the process in order for the process to be able to gracefully exit. SIGTERM is the standard linux/unix signal which should be handled by a running process and signals "please terminate" to the process.

After SIGTERM has been delivered, the process is usually doing house-keeping work in order to properly exit. This could take time and thus, the process might still be running for some more time after the SIGTERM signal has been sent. If I recall correctly, with clamd the main (clamd) process which has been signaled is then instructing its own children to terminate (clamd usually runs with more than one instance using so called worker processes which do the actual work - i.e. the scanning of files).

OpenRC, however, needs to know, when clamd has actually exited (only after that it can for instance instruct freshclam to stop as well) and there comes signal 0 into play: Signal 0 is just a sort of ping that checks whether a process is still running. It is not a real signal that is delivered to and needs to be handled by the receiving process, but the kill command's exit value indicates to the "sender" whether the process-ID that was provided on the command line (i.e. the clamd process's process-ID) is still alive.
jagdpanther wrote:Is this something that can be controlled or limited to onece per second?
If you really want to change this, you would need to look at clamd's OpenRC script and amend that to have a "sleep 1" command inbetween the "kill 0 $PID" shell script loop that you should be able to find somewhere in that script. I currently don't have access to a system, but I am sure, that loop sequence should be easy to spot in the OpenRC script.

I hope that helps. Atom2
Top
jagdpanther
l33t
l33t
Posts: 820
Joined: Sat Nov 22, 2003 2:26 pm

  • Quote

Post by jagdpanther » Mon Jul 09, 2018 4:19 pm

Atom2:

Thank you for the explanation. No I don't really need to change the behavior. I just noticed this on a newer Gentoo system and have not seen the same on an older system (that does get weekly emerge --update ...)
Top
Post Reply

3 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic