* 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 related [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 related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-01-30 21:13 UTC | newest]
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
Code repositories for project(s) associated with this public inbox
https://yhbt.net/rainbows.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).