Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to rescue from warnings / failures (Protocol::HTTP2::GoawayError) #119

Open
9mm opened this issue May 26, 2023 · 1 comment
Open

How to rescue from warnings / failures (Protocol::HTTP2::GoawayError) #119

9mm opened this issue May 26, 2023 · 1 comment

Comments

@9mm
Copy link

9mm commented May 26, 2023

I notice while async-http is running, after a few minutes I will get a Protocol::HTTP2::GoawayError, and then immediately after get OpenSSL::SSL::SSLError: SSL_write

In the short term, can I just rescue from any warning and wait 10 seconds and retry? Something like this:

begin
  Async do
    ...
  end
rescue
  sleep 10
  retry
end
    2m     warn: Async::Task [oid=0x9d8] [ec=0x9ec] [pid=22498] [2023-05-26 18:49:27 +0000]
               | Task may have ended with unhandled exception.
               |   Protocol::HTTP2::GoawayError:
               |   → /var/lib/gems/3.1.0/gems/protocol-http2-0.15.1/lib/protocol/http2/connection.rb:205 in `receive_goaway'
               |     /var/lib/gems/3.1.0/gems/protocol-http2-0.15.1/lib/protocol/http2/goaway_frame.rb:41 in `apply'
               |     /var/lib/gems/3.1.0/gems/protocol-http2-0.15.1/lib/protocol/http2/connection.rb:155 in `read_frame'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/protocol/http2/connection.rb:111 in `block in read_in_background'
               |     /var/lib/gems/3.1.0/gems/async-2.5.1/lib/async/task.rb:158 in `block in run'
               |     /var/lib/gems/3.1.0/gems/async-2.5.1/lib/async/task.rb:310 in `block in schedule'
    2m     warn: Async::Task [oid=0xa00] [ec=0xa14] [pid=22498] [2023-05-26 18:49:27 +0000]
               | Task may have ended with unhandled exception.
               |   Protocol::HTTP2::GoawayError:
               |   → /var/lib/gems/3.1.0/gems/protocol-http2-0.15.1/lib/protocol/http2/connection.rb:205 in `receive_goaway'
               |     /var/lib/gems/3.1.0/gems/protocol-http2-0.15.1/lib/protocol/http2/goaway_frame.rb:41 in `apply'
               |     /var/lib/gems/3.1.0/gems/protocol-http2-0.15.1/lib/protocol/http2/connection.rb:155 in `read_frame'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/protocol/http2/connection.rb:111 in `block in read_in_background'
               |     /var/lib/gems/3.1.0/gems/async-2.5.1/lib/async/task.rb:158 in `block in run'
               |     /var/lib/gems/3.1.0/gems/async-2.5.1/lib/async/task.rb:310 in `block in schedule'
    2m     warn: Async::Task [oid=0xa50] [ec=0xa64] [pid=22498] [2023-05-26 18:49:27 +0000]
               | Task may have ended with unhandled exception.
               |   OpenSSL::SSL::SSLError: SSL_write
               |   → /usr/lib/ruby/3.1.0/openssl/buffering.rb:415 in `syswrite_nonblock'
               |     /usr/lib/ruby/3.1.0/openssl/buffering.rb:415 in `write_nonblock'
               |     /var/lib/gems/3.1.0/gems/async-io-1.34.3/lib/async/io/generic.rb:216 in `async_send'
               |     /var/lib/gems/3.1.0/gems/async-io-1.34.3/lib/async/io/generic.rb:62 in `block in wrap_blocking_method'
               |     /var/lib/gems/3.1.0/gems/async-io-1.34.3/lib/async/io/generic.rb:156 in `write'
               |     /var/lib/gems/3.1.0/gems/async-io-1.34.3/lib/async/io/stream.rb:162 in `block in flush'
               |     /var/lib/gems/3.1.0/gems/async-2.5.1/lib/async/semaphore.rb:87 in `acquire'
               |     /var/lib/gems/3.1.0/gems/async-io-1.34.3/lib/async/io/stream.rb:157 in `flush'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/protocol/http2/connection.rb:97 in `write_frames'
               |     /var/lib/gems/3.1.0/gems/protocol-http2-0.15.1/lib/protocol/http2/stream.rb:145 in `write_headers'
               |     /var/lib/gems/3.1.0/gems/protocol-http2-0.15.1/lib/protocol/http2/stream.rb:159 in `send_headers'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/protocol/http2/response.rb:204 in `send_request'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/protocol/http2/client.rb:54 in `call'
               |     /var/lib/gems/3.1.0/gems/protocol-http-0.24.1/lib/protocol/http/request.rb:54 in `call'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/client.rb:185 in `make_response'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/client.rb:108 in `call'
               |     /var/lib/gems/3.1.0/gems/protocol-http-0.24.1/lib/protocol/http/middleware.rb:33 in `call'
               |     /var/lib/gems/3.1.0/gems/protocol-http-0.24.1/lib/protocol/http/accept_encoding.rb:35 in `call'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/internet.rb:67 in `call'
               |     /var/lib/gems/3.1.0/gems/async-http-0.60.1/lib/async/http/internet.rb:80 in `block (2 levels) in <class
               |     async.rb:119 in `block (3 levels) in <main>'
               |     /var/lib/gems/3.1.0/gems/async-2.5.1/lib/async/semaphore.rb:68 in `block in async'
               |     /var/lib/gems/3.1.0/gems/async-2.5.1/lib/async/task.rb:158 in `block in run'
               |     /var/lib/gems/3.1.0/gems/async-2.5.1/lib/async/task.rb:310 in `block in schedule'
    2m     warn: Async::Task [oid=0xa78] [ec=0xa8c] [pid=22498] [2023-05-26 18:49:27 +0000]
@9mm
Copy link
Author

9mm commented May 26, 2023

For anyone who wonders the same thing (probably no one 🦗🦗)

I did this

Async do |parent|
  semaphore.async do
    begin
      ...
    rescue
      parent.stop
    end
rescue Async::Stop
  # handle retry
end 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant