unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Unicorn Nginx Issue
@ 2009-10-13 16:57 Matt Mongeau
  2009-10-13 17:20 ` Brian Ketelsen
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Mongeau @ 2009-10-13 16:57 UTC (permalink / raw)
  To: mongrel-unicorn

I've setup nginx with this
server {
  listen 80;
  server_name unicorn.local;
  location / {
    proxy_pass http://unicorn;
  }
}
upstream unicorn {
  server unix:/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock;
}

When I run unicorn_rails -c config/unicorn.rb -E development I can
access the application just fine on unicorn.local

When I run unicorn_rails -c config/unicorn.rb -E development -D I get this issue

2009/10/13 12:34:22 [error] 1007#0: *62 connect() to
unix:/Users/user/projects/test/unicorn/tmp/sockets/unicorn.sock failed
(61: Connection refused) while connecting to upstream, client:
127.0.0.1, server: unicorn.local, request: "GET / HTTP/1.1", upstream:
"http://unix:/Users/user/projects/test/unicorn/tmp/sockets/unicorn.sock:/",
host: "unicorn.local"

ps -aux shows that the workers are created
and ls -la show srwxrwxrwx  1 mattmongeau  staff    0 Oct 13 12:51 unicorn.sock=

Any suggestions on what I am doing wrong. I running OSX 10.6.1, with
nginx installed from passenger (nginx version: nginx/0.6.37)

Thanks, Matt

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicorn Nginx Issue
  2009-10-13 16:57 Unicorn Nginx Issue Matt Mongeau
@ 2009-10-13 17:20 ` Brian Ketelsen
  2009-10-13 17:27   ` Matt Mongeau
  0 siblings, 1 reply; 8+ messages in thread
From: Brian Ketelsen @ 2009-10-13 17:20 UTC (permalink / raw)
  To: unicorn general mailing list



On Oct 13, 2009, at 12:57 PM, Matt Mongeau wrote:

> 2009/10/13 12:34:22 [error] 1007#0: *62 connect() to
> unix:/Users/user/projects/test/unicorn/tmp/sockets/unicorn.sock failed
> (61: Connection refused) while connecting to upstream, client:
> 127.0.0.1, server: unicorn.local, request: "GET / HTTP/1.1", upstream:
> "http://unix:/Users/user/projects/test/unicorn/tmp/sockets/unicorn.sock:/ 
> ",
> host: "unicorn.local"
>
> ps -aux shows that the workers are created
> and ls -la show srwxrwxrwx  1 mattmongeau  staff    0 Oct 13 12:51  
> unicorn.sock=
>
> Any suggestions on what I am doing wrong. I running OSX 10.6.1, with
> nginx installed from passenger (nginx version: nginx/0.6.37)
>
> Thanks, Matt
> _______________________________________________



You must have a host entry in /etc/hosts or in NetInfo for  
unicorn.local - do you have it set to "localhost" or to 127.0.0.1?   
I've seen issues in Mac OS where I had to explicitly use 127.0.0.1  
instead of localhost, and the error messages looked similar.

Brian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicorn Nginx Issue
  2009-10-13 17:20 ` Brian Ketelsen
@ 2009-10-13 17:27   ` Matt Mongeau
  2009-10-13 17:34     ` Matt Mongeau
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Mongeau @ 2009-10-13 17:27 UTC (permalink / raw)
  To: unicorn general mailing list

Hi Brian,

my /etc/hosts file has an entry like this:

127.0.0.1 unicorn.local

some further debugging...
this works:
unicorn_rails  -E production -l unix:tmp/sockets/unicorn.sock -D
this does not:
unicorn_rails  -E development -l unix:tmp/sockets/unicorn.sock -D

On Tue, Oct 13, 2009 at 1:20 PM, Brian Ketelsen <bketelsen@gmail.com> wrote:
>
>
> On Oct 13, 2009, at 12:57 PM, Matt Mongeau wrote:
>
>> 2009/10/13 12:34:22 [error] 1007#0: *62 connect() to
>> unix:/Users/user/projects/test/unicorn/tmp/sockets/unicorn.sock failed
>> (61: Connection refused) while connecting to upstream, client:
>> 127.0.0.1, server: unicorn.local, request: "GET / HTTP/1.1", upstream:
>>
>> "http://unix:/Users/user/projects/test/unicorn/tmp/sockets/unicorn.sock:/",
>> host: "unicorn.local"
>>
>> ps -aux shows that the workers are created
>> and ls -la show srwxrwxrwx  1 mattmongeau  staff    0 Oct 13 12:51
>> unicorn.sock=
>>
>> Any suggestions on what I am doing wrong. I running OSX 10.6.1, with
>> nginx installed from passenger (nginx version: nginx/0.6.37)
>>
>> Thanks, Matt
>> _______________________________________________
>
>
>
> You must have a host entry in /etc/hosts or in NetInfo for unicorn.local -
> do you have it set to "localhost" or to 127.0.0.1?  I've seen issues in Mac
> OS where I had to explicitly use 127.0.0.1 instead of localhost, and the
> error messages looked similar.
>
> Brian
> _______________________________________________
> mongrel-unicorn mailing list
> mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicorn Nginx Issue
  2009-10-13 17:27   ` Matt Mongeau
@ 2009-10-13 17:34     ` Matt Mongeau
  2009-10-13 18:53       ` Eric Wong
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Mongeau @ 2009-10-13 17:34 UTC (permalink / raw)
  To: unicorn general mailing list

Got it working, I had a bad value in my config.

I had
listen '/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
:backlog => 1024
I guess I needed
listen 'unix:/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
:backlog => 1024

Thanks for the help.

On Tue, Oct 13, 2009 at 1:27 PM, Matt Mongeau <halogenandtoast@gmail.com> wrote:
> Hi Brian,
>
> my /etc/hosts file has an entry like this:
>
> 127.0.0.1 unicorn.local
>
> some further debugging...
> this works:
> unicorn_rails  -E production -l unix:tmp/sockets/unicorn.sock -D
> this does not:
> unicorn_rails  -E development -l unix:tmp/sockets/unicorn.sock -D
>
> On Tue, Oct 13, 2009 at 1:20 PM, Brian Ketelsen <bketelsen@gmail.com> wrote:
>>
>>
>> On Oct 13, 2009, at 12:57 PM, Matt Mongeau wrote:
>>
>>> 2009/10/13 12:34:22 [error] 1007#0: *62 connect() to
>>> unix:/Users/user/projects/test/unicorn/tmp/sockets/unicorn.sock failed
>>> (61: Connection refused) while connecting to upstream, client:
>>> 127.0.0.1, server: unicorn.local, request: "GET / HTTP/1.1", upstream:
>>>
>>> "http://unix:/Users/user/projects/test/unicorn/tmp/sockets/unicorn.sock:/",
>>> host: "unicorn.local"
>>>
>>> ps -aux shows that the workers are created
>>> and ls -la show srwxrwxrwx  1 mattmongeau  staff    0 Oct 13 12:51
>>> unicorn.sock=
>>>
>>> Any suggestions on what I am doing wrong. I running OSX 10.6.1, with
>>> nginx installed from passenger (nginx version: nginx/0.6.37)
>>>
>>> Thanks, Matt
>>> _______________________________________________
>>
>>
>>
>> You must have a host entry in /etc/hosts or in NetInfo for unicorn.local -
>> do you have it set to "localhost" or to 127.0.0.1?  I've seen issues in Mac
>> OS where I had to explicitly use 127.0.0.1 instead of localhost, and the
>> error messages looked similar.
>>
>> Brian
>> _______________________________________________
>> mongrel-unicorn mailing list
>> mongrel-unicorn@rubyforge.org
>> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
>>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicorn Nginx Issue
  2009-10-13 17:34     ` Matt Mongeau
@ 2009-10-13 18:53       ` Eric Wong
  2009-10-13 19:03         ` Matt Mongeau
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Wong @ 2009-10-13 18:53 UTC (permalink / raw)
  To: unicorn general mailing list

Matt Mongeau <halogenandtoast@gmail.com> wrote:

Hi Matt, please don't top post, thanks.

> Got it working, I had a bad value in my config.
> 
> I had
> listen '/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
> :backlog => 1024
> I guess I needed
> listen 'unix:/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
> :backlog => 1024

Both values you had above really should just work.  Assuming you've
installed unicorn (>= 0.93.0) as a gem, can you run:

  gem check -t unicorn

and tell me if it passes?  If you installed from the tgz or git, you can
also try running the following from the source tree:

   make test/unit/test_configurator.rb

Thanks.

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicorn Nginx Issue
  2009-10-13 18:53       ` Eric Wong
@ 2009-10-13 19:03         ` Matt Mongeau
  2009-10-13 19:43           ` Eric Wong
  0 siblings, 1 reply; 8+ messages in thread
From: Matt Mongeau @ 2009-10-13 19:03 UTC (permalink / raw)
  To: unicorn general mailing list

sudo gem check -t unicorn

fails

Failure:
test_rack_lint_big_put(RequestTest) [./test/unit/test_request.rb:178]:
<nil> expected but was
<"

followed by lots whitespace

">.
Error:
test_expand_addr(TestConfigurator):
SocketError: getaddrinfo: nodename nor servname provided, or not known
    /opt/local/lib/ruby/gems/1.8/gems/unicorn-0.93.2/lib/unicorn/configurator.rb:346:in
`pack_sockaddr_in'
    /opt/local/lib/ruby/gems/1.8/gems/unicorn-0.93.2/lib/unicorn/configurator.rb:346:in
`expand_addr'
    ./test/unit/test_configurator.rb:35:in `call'
    ./test/unit/test_configurator.rb:35:in `test_expand_addr'
ERROR:  98 tests, 4748 assertions, 1 failures, 1 errors


On Tue, Oct 13, 2009 at 2:53 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Matt Mongeau <halogenandtoast@gmail.com> wrote:
>
> Hi Matt, please don't top post, thanks.
>
>> Got it working, I had a bad value in my config.
>>
>> I had
>> listen '/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
>> :backlog => 1024
>> I guess I needed
>> listen 'unix:/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
>> :backlog => 1024
>
> Both values you had above really should just work.  Assuming you've
> installed unicorn (>= 0.93.0) as a gem, can you run:
>
>  gem check -t unicorn
>
> and tell me if it passes?  If you installed from the tgz or git, you can
> also try running the following from the source tree:
>
>   make test/unit/test_configurator.rb
>
> Thanks.
>
> --
> Eric Wong
> _______________________________________________
> mongrel-unicorn mailing list
> mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicorn Nginx Issue
  2009-10-13 19:03         ` Matt Mongeau
@ 2009-10-13 19:43           ` Eric Wong
  2009-10-13 20:11             ` Matt Mongeau
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Wong @ 2009-10-13 19:43 UTC (permalink / raw)
  To: unicorn general mailing list

Matt Mongeau <halogenandtoast@gmail.com> wrote:
> sudo gem check -t unicorn

Again, please don't top post on this mailing list (nor on other technical
mailing lists in general).

> fails
> 
> Failure:
> test_rack_lint_big_put(RequestTest) [./test/unit/test_request.rb:178]:
> <nil> expected but was
> <"
> 
> followed by lots whitespace
> 
> ">.

Unrelated to the problem we were having, but this really should be
working, especially with 0.93.2 or later.  Is anybody else out there
hitting this?

> Error:
> test_expand_addr(TestConfigurator):
> SocketError: getaddrinfo: nodename nor servname provided, or not known
>     /opt/local/lib/ruby/gems/1.8/gems/unicorn-0.93.2/lib/unicorn/configurator.rb:346:in
> `pack_sockaddr_in'
>     /opt/local/lib/ruby/gems/1.8/gems/unicorn-0.93.2/lib/unicorn/configurator.rb:346:in
> `expand_addr'
>     ./test/unit/test_configurator.rb:35:in `call'
>     ./test/unit/test_configurator.rb:35:in `test_expand_addr'

This looks like a portability issue.  I'll probably rip those tests out
since a good chunk of systems don't addresses like this.

But above this test failure, the other test_expand_addr assertions
manage to pass which is strange, namely the following:

    meth = Unicorn::Configurator.new.method(:expand_addr)

    assert_equal "/var/run/unicorn.sock", meth.call("/var/run/unicorn.sock")
    assert_equal "#{Dir.pwd}/foo/bar.sock", meth.call("unix:foo/bar.sock")

Your original paths were under 104 bytes, too[1]

> >> I had
> >> listen '/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
> >> :backlog => 1024
> >> I guess I needed
> >> listen 'unix:/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
> >> :backlog => 1024

Does using a shorter path help at all?

Shorter (and shallower) paths are even a small bit faster because the
filesystem has to do less work to resolve it for every connection :)

[1] - http://portabilityblog.com/blog/archives/4-UNIX-domain-sockets.html

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicorn Nginx Issue
  2009-10-13 19:43           ` Eric Wong
@ 2009-10-13 20:11             ` Matt Mongeau
  0 siblings, 0 replies; 8+ messages in thread
From: Matt Mongeau @ 2009-10-13 20:11 UTC (permalink / raw)
  To: unicorn general mailing list

On Tue, Oct 13, 2009 at 3:43 PM, Eric Wong <normalperson@yhbt.net> wrote:
> Matt Mongeau <halogenandtoast@gmail.com> wrote:
>> sudo gem check -t unicorn
>
> Again, please don't top post on this mailing list (nor on other technical
> mailing lists in general).
>
>> fails
>>
>> Failure:
>> test_rack_lint_big_put(RequestTest) [./test/unit/test_request.rb:178]:
>> <nil> expected but was
>> <"
>>
>> followed by lots whitespace
>>
>> ">.
>
> Unrelated to the problem we were having, but this really should be
> working, especially with 0.93.2 or later.  Is anybody else out there
> hitting this?
>
>> Error:
>> test_expand_addr(TestConfigurator):
>> SocketError: getaddrinfo: nodename nor servname provided, or not known
>>     /opt/local/lib/ruby/gems/1.8/gems/unicorn-0.93.2/lib/unicorn/configurator.rb:346:in
>> `pack_sockaddr_in'
>>     /opt/local/lib/ruby/gems/1.8/gems/unicorn-0.93.2/lib/unicorn/configurator.rb:346:in
>> `expand_addr'
>>     ./test/unit/test_configurator.rb:35:in `call'
>>     ./test/unit/test_configurator.rb:35:in `test_expand_addr'
>
> This looks like a portability issue.  I'll probably rip those tests out
> since a good chunk of systems don't addresses like this.
>
> But above this test failure, the other test_expand_addr assertions
> manage to pass which is strange, namely the following:
>
>    meth = Unicorn::Configurator.new.method(:expand_addr)
>
>    assert_equal "/var/run/unicorn.sock", meth.call("/var/run/unicorn.sock")
>    assert_equal "#{Dir.pwd}/foo/bar.sock", meth.call("unix:foo/bar.sock")
>
> Your original paths were under 104 bytes, too[1]
>
>> >> I had
>> >> listen '/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
>> >> :backlog => 1024
>> >> I guess I needed
>> >> listen 'unix:/Users/mattmongeau/projects/test/unicorn/tmp/sockets/unicorn.sock',
>> >> :backlog => 1024
>
> Does using a shorter path help at all?
>
> Shorter (and shallower) paths are even a small bit faster because the
> filesystem has to do less work to resolve it for every connection :)
>
> [1] - http://portabilityblog.com/blog/archives/4-UNIX-domain-sockets.html
>
> --
> Eric Wong
> _______________________________________________
> mongrel-unicorn mailing list
> mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
>
Sorry for top posting, I actually didn't know what you meant by
that... had to have someone else explain it to me.

Ok my previous problem seems to be from running unicorn_rails multiple times
so if I run
unicorn_rails -c config/unicorn.rb -E development -D
it works fine (with and without the unix prefix on the socket)
then if I just run
unicorn_rails -c config/unicorn.rb -E development
without killing the current master everything seems to work
if I issue a term signal ^C to it and try
unicorn_rails -c config/unicorn.rb -E development -D
it no longer works

seems like I shouldn't issue these commands in tandem without first
killing the previous unicorn instance

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-10-13 20:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-13 16:57 Unicorn Nginx Issue Matt Mongeau
2009-10-13 17:20 ` Brian Ketelsen
2009-10-13 17:27   ` Matt Mongeau
2009-10-13 17:34     ` Matt Mongeau
2009-10-13 18:53       ` Eric Wong
2009-10-13 19:03         ` Matt Mongeau
2009-10-13 19:43           ` Eric Wong
2009-10-13 20:11             ` Matt Mongeau

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).