playwright-ruby-client
playwright-ruby-client copied to clipboard
Return control to main thread if Transport thread fails
Background
If there is an error within Transport's thread, it writes it to stderr but does not return control to the main thread, leaving the main thread waiting indefintely.
I saw this today when I upgraded to 1.54.0 but forgot to upgrade the Playwright binary from 1.52.x, therefore the client was trying to use the wrong binary API. I expected this to raise an exception, but it left the main thread hanging.
Question
I have worked-around this by wrapping my Playwright.create in a Timeout block, however I am curious if there is a better way to return control to the main thread?
Backtrace for reference:
#<Thread:0x00000001328648f8 /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/transport.rb:56 run> terminated with exception (report_on_exception is true):
/Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/connection.rb:273:in 'Playwright::Connection#create_remote_object': Missing type Selectors (RuntimeError)
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/connection.rb:181:in 'Playwright::Connection#dispatch'
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/connection.rb:11:in 'block in Playwright::Connection#initialize'
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/transport.rb:86:in 'Playwright::Transport#handle_stdout'
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/transport.rb:56:in 'block in Playwright::Transport#async_run'
/Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/connection.rb:266:in 'Module#const_get': uninitialized constant Playwright::ChannelOwners::Selectors (NameError)
ChannelOwners.const_get(type).new(
^^^^^^^^^^
Did you mean? Playwright::SelectorsImpl
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/connection.rb:266:in 'Playwright::Connection#create_remote_object'
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/connection.rb:181:in 'Playwright::Connection#dispatch'
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/connection.rb:11:in 'block in Playwright::Connection#initialize'
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/transport.rb:86:in 'Playwright::Transport#handle_stdout'
from /Users/joe/.local/share/mise/installs/ruby/3.4.4/lib/ruby/gems/3.4.0/gems/playwright-ruby-client-1.54.0/lib/playwright/transport.rb:56:in 'block in Playwright::Transport#async_run'