unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Ruby 2.0 Bad file descriptor (Errno::EBADF)
@ 2013-08-23  1:34 Port Himmerland
  2013-08-23  2:04 ` Eric Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Port Himmerland @ 2013-08-23  1:34 UTC (permalink / raw)
  To: mongrel-unicorn@rubyforge.org


hi. i've been trying to upgrade my stack to ruby 2.0 but keep getting this on ubuntu (not on my local os x):

/hello/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:746:in `for_fd': Bad file descriptor (Errno::EBADF)
from /hello/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:746:in `block in inherit_listeners!'
from /hello/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:745:in `map'
from /hello/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:745:in `inherit_listeners!'
from /hello/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:127:in `start'
from /hello/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/bin/unicorn_rails:209:in `<top (required)>'

this happens all the time for my legacy rails app, but i'm not able to reproduce on a tiny new rack app. i'm wondering if this could be related:

https://github.com/puma/puma/issues/177
https://github.com/puma/puma/pull/220

any tips?

--port


_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

* Re: Ruby 2.0 Bad file descriptor (Errno::EBADF)
  2013-08-23  1:34 Ruby 2.0 Bad file descriptor (Errno::EBADF) Port Himmerland
@ 2013-08-23  2:04 ` Eric Wong
  2013-08-23  6:21   ` port
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Wong @ 2013-08-23  2:04 UTC (permalink / raw)
  To: unicorn list

Port Himmerland <port.himmerland@icloud.com> wrote:
> hi. i've been trying to upgrade my stack to ruby 2.0 but keep getting this on ubuntu (not on my local os x):
> 
> /hello/shared/bundle/ruby/2.0.0/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:746:in `for_fd': Bad file descriptor (Errno::EBADF)
> 
> this happens all the time for my legacy rails app, but i'm not able to reproduce on a tiny new rack app. i'm wondering if this could be related:
> 
> https://github.com/puma/puma/issues/177
> https://github.com/puma/puma/pull/220

We've been prepared for close-on-exec by default since unicorn 4.1.0
over two years ago:

	commit 6ab27beeda3b0aaaa66f7cc4f734944a7aa84385
	Author: Eric Wong <normalperson@yhbt.net>
	Date:   Thu Aug 11 12:59:09 2011 -0700

	    future-proof against close-on-exec by default

Did you upgrade to Ruby 2.0.0 before upgrading to unicorn 4.1+?
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

* Re: Ruby 2.0 Bad file descriptor (Errno::EBADF)
  2013-08-23  2:04 ` Eric Wong
@ 2013-08-23  6:21   ` port
  2013-08-23  6:47     ` Eric Wong
  0 siblings, 1 reply; 6+ messages in thread
From: port @ 2013-08-23  6:21 UTC (permalink / raw)
  To: mongrel-unicorn

Eric Wong <normalperson <at> yhbt.net> writes:

> Did you upgrade to Ruby 2.0.0 before upgrading to unicorn 4.1+?

we've been running a unicorn 4.6.3 setup on ruby 1.9.3 for quite a while
with no similar issues. i'll keep digging through our lifecycle config
to see if i can get closer to the cause.


_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

* Re: Ruby 2.0 Bad file descriptor (Errno::EBADF)
  2013-08-23  6:21   ` port
@ 2013-08-23  6:47     ` Eric Wong
  2013-09-04 19:00       ` Eric Chapweske
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Wong @ 2013-08-23  6:47 UTC (permalink / raw)
  To: unicorn list

port <port.himmerland@icloud.com> wrote:
> Eric Wong <normalperson <at> yhbt.net> writes:
> 
> > Did you upgrade to Ruby 2.0.0 before upgrading to unicorn 4.1+?
> 
> we've been running a unicorn 4.6.3 setup on ruby 1.9.3 for quite a while
> with no similar issues. i'll keep digging through our lifecycle config
> to see if i can get closer to the cause.

OK, this is really strange; especially since you're only hitting this
on your legacy app and not a new one.

I certainly haven't hit this with Ruby 2.0.0 anywhere (neither unicorn
nor Rainbows!).  I'm fairly certain enough folks are using Ruby 2.0.0 by
now that we would have more reports if something were amiss.

Let us know what you find, thanks!
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

* Re: Ruby 2.0 Bad file descriptor (Errno::EBADF)
  2013-08-23  6:47     ` Eric Wong
@ 2013-09-04 19:00       ` Eric Chapweske
  2013-09-04 19:29         ` Eric Wong
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Chapweske @ 2013-09-04 19:00 UTC (permalink / raw)
  To: mongrel-unicorn

Eric Wong <normalperson <at> yhbt.net> writes:

> OK, this is really strange; especially since you're only hitting this
> on your legacy app and not a new one.
> 
> I certainly haven't hit this with Ruby 2.0.0 anywhere (neither unicorn
> nor Rainbows!).  I'm fairly certain enough folks are using Ruby 2.0.0 by
> now that we would have more reports if something were amiss.
> 
> Let us know what you find, thanks!


We ran into the same issue. For us, it was because we were executing the 
process using bundle exec.  Bundler doesn't preserve the 1.9 behavior around
FD inheritance. https://github.com/bundler/bundler/issues/2628


_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

* Re: Ruby 2.0 Bad file descriptor (Errno::EBADF)
  2013-09-04 19:00       ` Eric Chapweske
@ 2013-09-04 19:29         ` Eric Wong
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2013-09-04 19:29 UTC (permalink / raw)
  To: unicorn list

Eric Chapweske <eac@zendesk.com> wrote:
> We ran into the same issue. For us, it was because we were executing the 
> process using bundle exec.  Bundler doesn't preserve the 1.9 behavior around
> FD inheritance. https://github.com/bundler/bundler/issues/2628

Thanks Eric!  I just pushed out the following and updated the website.

Subject: [PATCH] Sandbox: document SIGUSR2 + bundler issue with 2.0.0

Thanks to Eric Chapweske for the heads up.

ref: http://mid.gmane.org/loom.20130904T205308-432@post.gmane.org
---
 Sandbox | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Sandbox b/Sandbox
index 1df149b..3c7f226 100644
--- a/Sandbox
+++ b/Sandbox
@@ -60,6 +60,13 @@ If you're using an older Bundler version (0.9.x), you may need to set or
 reset GEM_HOME, GEM_PATH and PATH environment variables in the
 before_exec hook as illustrated by http://gist.github.com/534668
 
+=== Ruby 2.0.0 close-on-exec and SIGUSR2 incompatibility
+
+Ruby 2.0.0 enforces FD_CLOEXEC on file descriptors by default.  unicorn
+has been prepared for this behavior since unicorn 4.1.0, but we forgot
+to remind the Bundler developers.  This issue is being tracked here:
+https://github.com/bundler/bundler/issues/2628
+
 == Isolate
 
 === Running
-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

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

end of thread, other threads:[~2013-09-04 19:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-23  1:34 Ruby 2.0 Bad file descriptor (Errno::EBADF) Port Himmerland
2013-08-23  2:04 ` Eric Wong
2013-08-23  6:21   ` port
2013-08-23  6:47     ` Eric Wong
2013-09-04 19:00       ` Eric Chapweske
2013-09-04 19:29         ` Eric Wong

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).