whazzmaster / guard-redis

Guard::Redis starts and restarts Redis
MIT License
8 stars 10 forks source link

Failing to shutdown correctly when shutdown_retries is defined #7

Closed ealders closed 7 years ago

ealders commented 8 years ago

If you define a value greater than 0 for shutdown_retries and in the shutdown_redis method after it has executed the process termination and entered the retry loop the system will start looking for the pidfile

INFO - Waiting for pidfile to appear at tmp/pids/redis.pid...

Of course there is no pidfile becaue it was destroyed when the process terminated by redis-server We get the following error...

Guard::Redis failed to achieve its <stop>, exception was:
> [#2a7c7e877dd1] RuntimeError: pidfile was never written to tmp/pids/redis.pid
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-redis-2.0.0/lib/guard/redis.rb:98:in `block in pid'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-redis-2.0.0/lib/guard/redis.rb:96:in `loop'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-redis-2.0.0/lib/guard/redis.rb:96:in `pid'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-redis-2.0.0/lib/guard/redis.rb:141:in `process_running?'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-redis-2.0.0/lib/guard/redis.rb:59:in `block in shutdown_redis'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-redis-2.0.0/lib/guard/redis.rb:58:in `times'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-redis-2.0.0/lib/guard/redis.rb:58:in `shutdown_redis'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-redis-2.0.0/lib/guard/redis.rb:24:in `stop'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:82:in `block in _supervise'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:79:in `catch'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:79:in `_supervise'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:22:in `block (3 levels) in run'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:119:in `block (2 levels) in _run_group_plugins'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:117:in `each'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:117:in `block in _run_group_plugins'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:116:in `catch'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:116:in `_run_group_plugins'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:21:in `block (2 levels) in run'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:20:in `each'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:20:in `block in run'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/lumberjack-1.0.10/lib/lumberjack.rb:32:in `unit_of_work'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/runner.rb:18:in `run'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/commander.rb:58:in `stop'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/commander.rb:50:in `start'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/cli/environments/valid.rb:16:in `start_guard'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/cli.rb:122:in `start'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:32:in `execute'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/lib/guard/aruba_adapter.rb:19:in `execute!'
> [#2a7c7e877dd1] /Users/ealders/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.13.0/bin/_guard-core:11:in `<main>'

Seems something is not quite right.

ealders commented 8 years ago

Looks like the issue is with the pid call. The logic that set @pid in v0.3.0 was removed and the new logic is bombing out because when you send the TERM signal to the process it deletes the pidfile.