twalpole / apparition

Capybara driver for Chrome using CDP
MIT License
363 stars 46 forks source link

Works in dev but not production: No live threads left. Deadlock? #48

Closed alexchumak closed 4 years ago

alexchumak commented 4 years ago

Running on master. Works in dev environment, MacOS. In production, Amazon Linux, I get this error the first time I invoke Capybara's "visit". Any ideas?

Running it via a rake task.

fatal: No live threads left. Deadlock?
1 threads, 1 sleeps current:0x0000000001072470 main thread:0x0000000001072470
* #<Thread:0x000000000109f370 sleep_forever>
   rb_thread_t:0x0000000001072470 native:0x00007f26dc927740 int:0
../ruby/2.6.0/bundler/gems/apparition-f34790959e64/lib/capybara/apparition/driver/launcher.rb:93:in `pop'
../ruby/2.6.0/bundler/gems/apparition-f34790959e64/lib/capybara/apparition/driver/launcher.rb:93:in `block in ws_url'
../ruby/2.6.0/bundler/gems/apparition-f34790959e64/lib/capybara/apparition/driver/launcher.rb:92:in `loop'
../ruby/2.6.0/bundler/gems/apparition-f34790959e64/lib/capybara/apparition/driver/launcher.rb:92:in `ws_url'
../ruby/2.6.0/bundler/gems/apparition-f34790959e64/lib/capybara/apparition/driver.rb:71:in `client'
../ruby/2.6.0/bundler/gems/apparition-f34790959e64/lib/capybara/apparition/driver.rb:50:in `browser'
../ruby/2.6.0/bundler/gems/apparition-f34790959e64/lib/capybara/apparition/driver.rb:93:in `visit'
../ruby/2.6.0/gems/capybara-3.32.1/lib/capybara/session.rb:278:in `visit'
../ruby/2.6.0/gems/capybara-3.32.1/lib/capybara/dsl.rb:58:in `block (2 levels) in <module:DSL>'
twalpole commented 4 years ago

No idea with just that stack trace.

piya23300 commented 4 years ago

I found this problem too T.T

@alexchumak DO you have any solutions?

alexchumak commented 4 years ago

@piya23300, nope. But I haven't had a chance to dive into it any deeper. Please do let me know if you get anywhere with this. Thank you!

machado144 commented 4 years ago

Do you have any specifications about how did you started your Apparition session? Did you used any chrome flags?

I got this issue too by running my tests with some of my browser_options as nil. After i updated them to true, it started to work (Those configs are used on Amazon Linux too)

Code that returns this deadlock error: browser_options: { 'disable-gpu': nil, 'no-sandbox': nil, 'user-agent': "xxxx" }

With Deadlock error solved: browser_options: { 'disable-gpu': true, 'no-sandbox': true, 'user-agent': "xxxx" }

Maybe with more specifications we can get into a solution for this. @piya23300 @alexchumak

alexchumak commented 4 years ago

Thank you @machado144! Setting the browser options did the trick!

Much appreciated!