mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- Add workaround for signal/syscall interruption bug in ruby 1.8.5
This commit is contained in:
parent
1ac4ed62a6
commit
a2c4c15918
1 changed files with 12 additions and 2 deletions
|
@ -62,12 +62,22 @@ class LogStash::Daemon < LogStash::Program
|
|||
# in ruby 1.8.5 related to handling SIGTERM.
|
||||
|
||||
while @children.keys.length > 0
|
||||
pid = Process.waitpid(-1, 0)
|
||||
if pid and !dying?
|
||||
# Ruby 1.8.5 has a bug with signal and syscall handlers.
|
||||
if RUBY_VERSION == "1.8.5"
|
||||
pid = Process.waitpid(-1, Process::WNOHANG)
|
||||
else
|
||||
pid = Process.waitpid(-1, 0)
|
||||
end
|
||||
|
||||
if pid and dying?
|
||||
$logger.fatal "pid #{pid} died unexpectedly (#{@children[pid]}), " \
|
||||
"initiating shutdown"
|
||||
Process.kill("TERM", $$)
|
||||
end
|
||||
|
||||
if RUBY_VERSION == "1.8.5"
|
||||
sleep(5)
|
||||
end
|
||||
end
|
||||
|
||||
return 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue