Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to start DRB: port already in use #6

Open
JustinAiken opened this issue Nov 12, 2013 · 7 comments
Open

Failed to start DRB: port already in use #6

JustinAiken opened this issue Nov 12, 2013 · 7 comments

Comments

@JustinAiken
Copy link
Member

I've occasionally seen adhearsion-drb fail to initialize, both legitimately (something already had the port), or freakishly randomly. No log at the moment, I'll try to capture one next time I see a random fail...

But, if it does fail, it just logs a one-line error, and the adhearsion up starts up normally. Most applications using adhearsion-drb probably rely on it for core functionallity, so I think adhearsion-drb should either:

  • Keep trying to start the service upon failure
  • Prevent ahn from starting up at all (if options are enabled)
  • Something else?

Any thoughts about better failure handling?

@benlangfeld
Copy link
Member

I'll come back to better handling the failure later. For now, how are you ascertaining that nothing is holding the port?

@JustinAiken
Copy link
Member Author

If I kill ahn and immediately start it again, it works.. thought it was a Vagrant networking thing while I was developing it, but also seeing it on a live staging server too.

@benlangfeld
Copy link
Member

How do you kill ahn? killall ahn, or targeted at a particular PID?

@JustinAiken
Copy link
Member Author

In development, ctrl-c, in staging restarting it with God, which executes:

"cd #{@talkbox_path} && bundle exec ahn stop . && bundle exec ahn daemon ."

@JustinAiken
Copy link
Member Author

[2013-11-12 16:25:19] INFO  Adhearsion::Drb::Plugin::Service: Starting DRb on 0.0.0.0:9050
[2013-11-12 16:25:19] DEBUG Celluloid: Terminating 4 actors...
[2013-11-12 16:25:19] DEBUG Punchblock::Connection::Asterisk: Finalizing stream
/usr/local/lib/ruby/1.9.1/drb/drb.rb:861:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
    from /usr/local/lib/ruby/1.9.1/drb/drb.rb:861:in `open'
    from /usr/local/lib/ruby/1.9.1/drb/drb.rb:861:in `open_server'
    from /usr/local/lib/ruby/1.9.1/drb/drb.rb:759:in `block in open_server'
    from /usr/local/lib/ruby/1.9.1/drb/drb.rb:757:in `each'
    from /usr/local/lib/ruby/1.9.1/drb/drb.rb:757:in `open_server'
    from /usr/local/lib/ruby/1.9.1/drb/drb.rb:1342:in `initialize'
    from /usr/local/lib/ruby/1.9.1/drb/drb.rb:1624:in `new'
    from /usr/local/lib/ruby/1.9.1/drb/drb.rb:1624:in `start_service'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-drb-1.0.0/lib/adhearsion/drb/plugin/service.rb:19:in `start'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-drb-1.0.0/lib/adhearsion/drb/plugin.rb:27:in `block in <class:Plugin>'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/plugin/initializer.rb:26:in `instance_exec'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/plugin/initializer.rb:26:in `run'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/plugin.rb:168:in `block in init_plugins'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/plugin.rb:167:in `each'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/plugin.rb:167:in `init_plugins'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/initializer.rb:229:in `init_plugins'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/initializer.rb:61:in `block in start'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/initializer.rb:41:in `catch'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/initializer.rb:41:in `start'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/initializer.rb:12:in `start'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/cli_commands/ahn_command.rb:103:in `start_app'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/adhearsion-2.4.0/lib/adhearsion/cli_commands/ahn_command.rb:48:in `daemon'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
    from /data/apps/talkbox/shared/bundle/ruby/1.9.1/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
    from script/ahn:9:in `<main>'

@bklang
Copy link
Member

bklang commented Nov 12, 2013

This implies some other process already has the port open. Is it possible that you have another instance of Adhearsion (perhaps not quite shutdown) still running? Even another Ruby process using DRb on the same port?

@JustinAiken
Copy link
Member Author

No other ahn running at the time... forgot to netstat when it happened to see if anything listening to the port, will next time it occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants