Open
Description
Problem:
When we tried to start spring as background process on CircleCI we got this error:
/home/ubuntu/fundbase/vendor/bundle/ruby/1.9.1/bundler/gems/spring-5b27cda52354/lib/spring/sid.rb:41:in `getpgid': No such process (Errno::ESRCH)
from /home/ubuntu/fundbase/vendor/bundle/ruby/1.9.1/bundler/gems/spring-5b27cda52354/lib/spring/sid.rb:41:in `pgid'
from /home/ubuntu/fundbase/vendor/bundle/ruby/1.9.1/bundler/gems/spring-5b27cda52354/lib/spring/server.rb:78:in `set_pgid'
The reason behind this error according to #231 (comment) is that CircleCI runs a background process with a command equivalent to nohup bash -c "./daemon &"
and since there is no associated terminal Process.getsid
is returning nil or 0.
Solution:
After some debugging i found that we actually don't need process group ID pgid
on CircleCI and that Session ID sid
is sufficient to keep spring running in background. Thus, i modified self.pgid
method to be:
def self.pgid
return sid if ENV['CIRCLECI']
Process.getpgid(sid)
end
So, I've 2 questions:
1- I'm not sure what can go wrong if we relied on sid
only for background processes?.
2- can we make this configurable ?.
Metadata
Metadata
Assignees
Labels
No labels