Rainbows! Rack HTTP server user/dev discussion
 help / Atom feed
* undefined method `process_loop' for #<Unicorn::TCPClient:fd 14>
@ 2017-04-02  0:05 Claudio Poli
  2017-04-02  0:26 ` Eric Wong
  2017-04-02  1:54 ` [PATCH] workaround for unicorn 5.3.0 Eric Wong
  0 siblings, 2 replies; 7+ messages in thread
From: Claudio Poli @ 2017-04-02  0:05 UTC (permalink / raw)
  To: rainbows-public

hello,
I’m using Rainbows! 5.1.0 and I did a bundle update, unicorn got upgraded from 5.2.0 to 5.3.0 and I’m getting this:

02:02:27 web.1     | E, [2017-04-02T02:02:27.407688 #23360] ERROR -- : listen loop error: undefined method `process_loop' for #<Unicorn::TCPClient:fd 14> (NoMethodError)
02:02:27 web.1     | E, [2017-04-02T02:02:27.407805 #23360] ERROR -- : /Users/kain/.rvm/gems/ruby-2.4.1/gems/rainbows-5.1.0/lib/rainbows/thread_pool.rb:55:in `block in async_worker'
02:02:27 web.1     | E, [2017-04-02T02:02:27.407855 #23360] ERROR -- : /Users/kain/.rvm/gems/ruby-2.4.1/gems/rainbows-5.1.0/lib/rainbows/thread_pool.rb:54:in `each'
02:02:27 web.1     | E, [2017-04-02T02:02:27.407899 #23360] ERROR -- : /Users/kain/.rvm/gems/ruby-2.4.1/gems/rainbows-5.1.0/lib/rainbows/thread_pool.rb:54:in `async_worker'
02:02:27 web.1     | E, [2017-04-02T02:02:27.407939 #23360] ERROR -- : /Users/kain/.rvm/gems/ruby-2.4.1/gems/rainbows-5.1.0/lib/rainbows/thread_pool.rb:25:in `block (2 levels) in worker_loop'

thanks,
c

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

* Re: undefined method `process_loop' for #<Unicorn::TCPClient:fd 14>
  2017-04-02  0:05 undefined method `process_loop' for #<Unicorn::TCPClient:fd 14> Claudio Poli
@ 2017-04-02  0:26 ` Eric Wong
  2017-04-02  0:32   ` Eric Wong
  2017-04-02  1:54 ` [PATCH] workaround for unicorn 5.3.0 Eric Wong
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Wong @ 2017-04-02  0:26 UTC (permalink / raw)
  To: Claudio Poli; +Cc: rainbows-public

Claudio Poli <masterkain@gmail.com> wrote:
> hello,
> I’m using Rainbows! 5.1.0 and I did a bundle update, unicorn got upgraded from 5.2.0 to 5.3.0 and I’m getting this:
> 

Oops!  I totally forget about this project, again.  Thanks for
the report.  Can you give the following a try?  Should be
compatible with all unicorn 5.1+.

(It'll take me a while to test on my Centrino laptop)

diff --git a/lib/rainbows/coolio/server.rb b/lib/rainbows/coolio/server.rb
index 0d8af8c..a24d65e 100644
--- a/lib/rainbows/coolio/server.rb
+++ b/lib/rainbows/coolio/server.rb
@@ -6,6 +6,6 @@ class Rainbows::Coolio::Server < Coolio::IO
 
   def on_readable
     return if CONN.size >= MAX
-    io = @_io.kgio_tryaccept and CL.new(io).attach(LOOP)
+    io = @_io.kgio_tryaccept(Rainbows::Client) and CL.new(io).attach(LOOP)
   end
 end
diff --git a/lib/rainbows/epoll/server.rb b/lib/rainbows/epoll/server.rb
index ab5a49f..daa6df3 100644
--- a/lib/rainbows/epoll/server.rb
+++ b/lib/rainbows/epoll/server.rb
@@ -23,7 +23,7 @@ def self.extended(sock)
 
   def epoll_run
     return EP.delete(self) if @@nr >= MAX
-    while io = kgio_tryaccept
+    while io = kgio_tryaccept(Rainbows::Client)
       @@nr += 1
       # there's a chance the client never even sees epoll for simple apps
       io.epoll_once
diff --git a/lib/rainbows/fiber/coolio/server.rb b/lib/rainbows/fiber/coolio/server.rb
index 3d8d85e..51c4054 100644
--- a/lib/rainbows/fiber/coolio/server.rb
+++ b/lib/rainbows/fiber/coolio/server.rb
@@ -17,7 +17,7 @@ def close
 
   def on_readable
     return if Rainbows.cur >= MAX
-    c = @io.kgio_tryaccept and Fiber.new { process(c) }.resume
+    c = @io.kgio_tryaccept(Rainbows::Client) and Fiber.new { process(c) }.resume
   end
 
   def process(io)
diff --git a/lib/rainbows/fiber_spawn.rb b/lib/rainbows/fiber_spawn.rb
index 2c6d13d..3f0ec4a 100644
--- a/lib/rainbows/fiber_spawn.rb
+++ b/lib/rainbows/fiber_spawn.rb
@@ -23,7 +23,7 @@ def worker_loop(worker) # :nodoc:
     begin
       schedule do |l|
         break if Rainbows.cur >= limit
-        io = l.kgio_tryaccept or next
+        io = l.kgio_tryaccept(Rainbows::Client) or next
         Fiber.new { process(io) }.resume
       end
     rescue => e
diff --git a/lib/rainbows/thread_pool.rb b/lib/rainbows/thread_pool.rb
index 63d57cb..04305ed 100644
--- a/lib/rainbows/thread_pool.rb
+++ b/lib/rainbows/thread_pool.rb
@@ -38,7 +38,7 @@ def worker_loop(worker) # :nodoc:
   def sync_worker # :nodoc:
     s = LISTENERS[0]
     begin
-      c = s.kgio_accept and c.process_loop
+      c = s.kgio_accept(Rainbows::Client) and c.process_loop
     rescue => e
       Rainbows::Error.listen_loop(e)
     end while Rainbows.alive
@@ -52,7 +52,7 @@ def async_worker # :nodoc:
       # problem.  On the other hand, a thundering herd may not
       # even incur as much overhead as an extra Mutex#synchronize
       ret = select(LISTENERS) and ret[0].each do |s|
-        s = s.kgio_tryaccept and s.process_loop
+        s = s.kgio_tryaccept(Rainbows::Client) and s.process_loop
       end
     rescue Errno::EINTR
     rescue => e
diff --git a/lib/rainbows/thread_spawn.rb b/lib/rainbows/thread_spawn.rb
index b304688..8ea75bf 100644
--- a/lib/rainbows/thread_spawn.rb
+++ b/lib/rainbows/thread_spawn.rb
@@ -29,7 +29,7 @@ def accept_loop(klass) #:nodoc:
         begin
           if lock.synchronize { nr >= limit }
             worker_yield
-          elsif client = l.kgio_accept
+          elsif client = l.kgio_accept(Rainbows::Client)
             klass.new(client) do |c|
               begin
                 lock.synchronize { nr += 1 }

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

* Re: undefined method `process_loop' for #<Unicorn::TCPClient:fd 14>
  2017-04-02  0:26 ` Eric Wong
@ 2017-04-02  0:32   ` Eric Wong
  2017-04-02 23:21     ` Claudio Poli
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Wong @ 2017-04-02  0:32 UTC (permalink / raw)
  To: Claudio Poli; +Cc: rainbows-public

Eric Wong <e@80x24.org> wrote:
> the report.  Can you give the following a try?

Nm, better patch coming.

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

* [PATCH] workaround for unicorn 5.3.0
  2017-04-02  0:05 undefined method `process_loop' for #<Unicorn::TCPClient:fd 14> Claudio Poli
  2017-04-02  0:26 ` Eric Wong
@ 2017-04-02  1:54 ` Eric Wong
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Wong @ 2017-04-02  1:54 UTC (permalink / raw)
  To: Claudio Poli; +Cc: rainbows-public

unicorn 5.3.0 introduced a new Unicorn::TCPSrv and
Unicorn::TCPClient constants to distinguish TCP sockets
from Unix ones from its check_client_connection feature.

These classes screw up our direct inheritance of Kgio::Socket
from the Rainbows::Client class.  Since we do not support
check_client_connection, we do not need these new classes in
unicorn.  Removing Unicorn::TCPSrv and aliasing it as
Kgio::TCPServer is sufficient for now.  In the future,
removing all kgio dependencies from Rainbows! will be prioritized.

Thanks to Claudio Poli for reporting the bug:

  https://bogomips.org/rainbows-public/9267B33C-D13C-47E1-8892-4777B96DDCD1@gmail.com/
---
  This patch passes all tests, expect a release coming ASAP.
  Thanks again.

 lib/rainbows.rb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index acfe911..584c94b 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -149,3 +149,12 @@ def self.now # Ruby <= 2.0
 
 require 'rainbows/error'
 require 'rainbows/configurator'
+
+module Unicorn
+  # this interferes with Rainbows::Client creation with unicorn 5.3
+  begin
+    remove_const :TCPSrv
+    TCPSrv = Kgio::TCPServer
+  rescue NameError # unicorn < 5.3.0
+  end
+end
-- 
EW

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

* Re: undefined method `process_loop' for #<Unicorn::TCPClient:fd 14>
  2017-04-02  0:32   ` Eric Wong
@ 2017-04-02 23:21     ` Claudio Poli
       [not found]       ` <CANp6QoJXRbPLqmOPpG7XmZBc+oYqLWCcq1ipvOyNEQPXDEwx9Q@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Claudio Poli @ 2017-04-02 23:21 UTC (permalink / raw)
  To: Eric Wong; +Cc: rainbows-public

Thanks Eric,
sorry I had didn’t have a chance to test the patch, but I installed the new release and everything seems fine.

Rainbows! best web server out there.

Best,
c

> On 2 Apr 2017, at 02:32, Eric Wong <e@80x24.org> wrote:
> 
> Eric Wong <e@80x24.org> wrote:
>> the report.  Can you give the following a try?
> 
> Nm, better patch coming.


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

* Re: undefined method `process_loop' for #<Unicorn::TCPClient:fd 14>
       [not found]       ` <CANp6QoJXRbPLqmOPpG7XmZBc+oYqLWCcq1ipvOyNEQPXDEwx9Q@mail.gmail.com>
@ 2018-01-19 17:07         ` Eric Wong
       [not found]           ` <B05FC728-A46F-4056-997D-0BEE64A9A110@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Wong @ 2018-01-19 17:07 UTC (permalink / raw)
  To: kain; +Cc: rainbows-public, kgio-public

kain <masterkain@gmail.com> wrote:
> hello Eric,
> I tried upgrading ruby to 2.5.0 from 2.3.4 on our big project, I have this
> issue on rainbows if you would like to look into:
> 
> E, [2018-01-19T16:17:56.595280 #76399] ERROR -- : wrong number of arguments
> (given 16, expected 0) (ArgumentError)

Ah, this might be a bug in kgio with clang and 2.5.
The following patch should fix it:
	https://bogomips.org/kgio-public/20180119170307.19295-1-e@80x24.org/raw

and I've uploaded kgio 2.11.1.1.g36ea to Rubygems.org.
Can you try it and give it a shot?

	gem install --pre kgio -v 2.11.1.1.g36ea

I'll make a real kgio release with your confirmation.  Thanks

> /Users/kain/.rvm/gems/ruby-2.5.0/gems/rainbows-5.1.1/lib/rainbows/response.rb:13:in
> `included_modules'
> 
> /Users/kain/.rvm/gems/ruby-2.5.0/gems/rainbows-5.1.1/lib/rainbows/response.rb:13:in
> `accept_class='

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

* Re: undefined method `process_loop' for #<Unicorn::TCPClient:fd 14>
       [not found]           ` <B05FC728-A46F-4056-997D-0BEE64A9A110@gmail.com>
@ 2018-01-30 21:13             ` Eric Wong
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Wong @ 2018-01-30 21:13 UTC (permalink / raw)
  To: Claudio Poli; +Cc: rainbows-public, kgio-public

Claudio Poli <masterkain@gmail.com> wrote:
> hello Eric,
> I can confirm the bugs goes away with this version

Thanks for confirming.

Btw, please don't send HTML mail in the future since it's
spammy and too expensive to archive.  Thanks again.

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-02  0:05 undefined method `process_loop' for #<Unicorn::TCPClient:fd 14> Claudio Poli
2017-04-02  0:26 ` Eric Wong
2017-04-02  0:32   ` Eric Wong
2017-04-02 23:21     ` Claudio Poli
     [not found]       ` <CANp6QoJXRbPLqmOPpG7XmZBc+oYqLWCcq1ipvOyNEQPXDEwx9Q@mail.gmail.com>
2018-01-19 17:07         ` Eric Wong
     [not found]           ` <B05FC728-A46F-4056-997D-0BEE64A9A110@gmail.com>
2018-01-30 21:13             ` Eric Wong
2017-04-02  1:54 ` [PATCH] workaround for unicorn 5.3.0 Eric Wong

Rainbows! Rack HTTP server user/dev discussion

Archives are clonable:
	git clone --mirror https://bogomips.org/rainbows-public
	git clone --mirror http://ou63pmih66umazou.onion/rainbows-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.rainbows
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.rainbows

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox