ddollar / foreman

Manage Procfile-based applications

Home Page:http://ddollar.github.com/foreman

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running grunt foreman .rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/lib/foreman/engine.rb:193:in `kill': no implicit conversion from nil to integer (TypeError)

bneiluj opened this issue · comments

Configuration:

  • OSX El Capitan
  • Node v4.4.4
  • Grunt 0.4.5
  • Grunt-cli: 0.1.13
  • grunt-foreman": 0.0.10

When I run grunt foreman then I get:

Running "foreman:dev" (foreman) task
11:03:16 web.1  | started with pid 9830
11:03:16 ldap.1 | unknown command: nodemon --watch ldap ldap/index.js
11:03:16 web.1  | sh: nodemon: command not found
11:03:16 web.1  | exited with code 127
11:03:16 system | sending SIGTERM to all processes
/Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/lib/foreman/engine.rb:193:in `kill': no implicit conversion from nil to integer (TypeError)
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/lib/foreman/engine.rb:193:in `kill_children'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/lib/foreman/engine.rb:465:in `terminate_gracefully'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/lib/foreman/engine.rb:431:in `wait_for_shutdown_or_child_termination'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/lib/foreman/engine.rb:60:in `start'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/lib/foreman/cli.rb:41:in `start'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/bin/foreman:7:in `<top (required)>'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/bin/foreman:23:in `load'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/bin/foreman:23:in `<main>'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
        from /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

Error: /Users/j.bouteloup/.rvm/gems/ruby-2.3.0/gems/foreman-0.82.0/lib/foreman/engine.rb:193:in kill': no implicit conversion from nil to integer (TypeError)`

Sometimes I manage to make it working by following those steps:

  • Run: rm -rf node_modules/grunt-foreman
  • Run: gem uninstall -i /Users/j.bouteloup/.rvm/gems/ruby-2.3.0 foreman
  • ReInstall foreman: gem install foreman
  • Run: rvm use ruby-2.3.0
  • Reload rvm: rvm reload
  • Run: npm install

It doesn't always fix the error. Also, when I restart my mac or the shell I get the error again.

I just had the same experience. Dug a little into the stack causing this, and it seems that @running.keys will sometimes have nil values in it (I'd guess if a process never gets a pid) - but the kill_children function assumes it only consists of integers.

I fixed it locally by simply compacting the array, maybe you can use that? I can of course provide a patch as well :)

@jesperrasmussen When I tried your method I got an argument error. Are you compacting @running.keys or a different array.

But regardless, after looking to fix this it occurred to me that this isn't a bug, it's a feature. If it's trying to kill a process that isn't there it's because there was a problem with the process not the cleanup. It can be easy to miss the line that a process failed to run, but usually you'll want to address what happened to cause this error, not the error itself.

@bneiluj is this still an issue?