You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we got this errors when trying to run multiple engine drivers in upstream.rb. It seems that the method Thread.new doesnt play nicely with Eventmachine Symphony which is based on Fiber.
this is the full error.
#<Thread:0x000055a3665aa410@/home/app/app/workers/daemons/upstream.rb:8 run> terminated with exception (report_on_exception is true):
(eval):8:in resume': fiber called across threads (FiberError) from (eval):8:in block in get'
from /opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/em/deferrable.rb:151:in set_deferred_status' from /opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/em/deferrable.rb:191:in succeed'
from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:113:in unbind' from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:71:in on_request_complete'
from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:204:in block in post_init' from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:219:in <<'
from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:219:in receive_data' from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:26:in receive_data'
from /opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in run_machine' from /opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in run'
from /opt/vendor/bundle/ruby/2.6.0/gems/em-synchrony-1.0.6/lib/em-synchrony.rb:39:in synchrony' from /home/app/app/workers/daemons/upstream.rb:12:in process'
from /home/app/app/workers/daemons/upstream.rb:8:in block (3 levels) in run' {"level":"ERROR","time":"2021-05-10 03:31:41","message":"#<FiberError: fiber called across threads>"} {"level":"ERROR","time":"2021-05-10 03:31:41","message":"(eval):8:in resume'\n(eval):8:in block in get'\n/opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/em/deferrable.rb:151:in set_deferred_status'\n/opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/em/deferrable.rb:191:in succeed'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:113:in unbind'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:71:in on_request_complete'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:204:in block in post_init'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:219:in <<'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:219:in receive_data'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:26:in receive_data'\n/opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in run_machine'\n/opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in run'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-synchrony-1.0.6/lib/em-synchrony.rb:39:in synchrony'\n/home/app/app/workers/daemons/upstream.rb:12:in process'\n/home/app/app/workers/daemons/upstream.rb:8:in block (3 levels) in run'"}
It seems that Fiber and Thread do not play well with each other. Hence we replace Thread.new with Fiber.new but upstream can only read one engine driver and ignore the rest. Feedback and suggestions are appreciated.
Hi there,
we got this errors when trying to run multiple engine drivers in upstream.rb. It seems that the method Thread.new doesnt play nicely with Eventmachine Symphony which is based on Fiber.
this is the full error.
#<Thread:0x000055a3665aa410@/home/app/app/workers/daemons/upstream.rb:8 run> terminated with exception (report_on_exception is true):
(eval):8:in
resume': fiber called across threads (FiberError) from (eval):8:in
block in get'from /opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/em/deferrable.rb:151:in
set_deferred_status' from /opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/em/deferrable.rb:191:in
succeed'from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:113:in
unbind' from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:71:in
on_request_complete'from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:204:in
block in post_init' from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:219:in
<<'from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:219:in
receive_data' from /opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:26:in
receive_data'from /opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in
run_machine' from /opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in
run'from /opt/vendor/bundle/ruby/2.6.0/gems/em-synchrony-1.0.6/lib/em-synchrony.rb:39:in
synchrony' from /home/app/app/workers/daemons/upstream.rb:12:in
process'from /home/app/app/workers/daemons/upstream.rb:8:in
block (3 levels) in run' {"level":"ERROR","time":"2021-05-10 03:31:41","message":"#<FiberError: fiber called across threads>"} {"level":"ERROR","time":"2021-05-10 03:31:41","message":"(eval):8:in
resume'\n(eval):8:inblock in get'\n/opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/em/deferrable.rb:151:in
set_deferred_status'\n/opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/em/deferrable.rb:191:insucceed'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:113:in
unbind'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/client.rb:71:inon_request_complete'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:204:in
block in post_init'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:219:in<<'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:219:in
receive_data'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-http-request-1.1.7/lib/em-http/http_connection.rb:26:inreceive_data'\n/opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in
run_machine'\n/opt/vendor/bundle/ruby/2.6.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:inrun'\n/opt/vendor/bundle/ruby/2.6.0/gems/em-synchrony-1.0.6/lib/em-synchrony.rb:39:in
synchrony'\n/home/app/app/workers/daemons/upstream.rb:12:inprocess'\n/home/app/app/workers/daemons/upstream.rb:8:in
block (3 levels) in run'"}It seems that Fiber and Thread do not play well with each other. Hence we replace Thread.new with Fiber.new but upstream can only read one engine driver and ignore the rest. Feedback and suggestions are appreciated.
openware original code:
Engine.all.map { |e| Thread.new { process(e) } }.map(&:join)
we change to:
Engine.all.map { |e| Fiber.new { process(e) } }.map(&:join)
Thank you
The text was updated successfully, but these errors were encountered: