ostinelli / apnotic

A Ruby APNs HTTP/2 gem able to provide instant feedback.
MIT License
477 stars 95 forks source link

Socket was remotely closed #117

Closed RLSWE closed 2 years ago

RLSWE commented 2 years ago

Hey. We are using version 1.7.0 and our monitoring system get's a lot of those errors. Like 10-20 a day.

The error, to more precise, is reported as:

SocketError vendor/ruby-2.7.3/lib/ruby/2.7.0/openssl/buffering.rb:182
Socket was remotely closed

Sending push to iOS does work it seems. So I wonder if this affects only some of the users or none at all. Is there a way to know: a. Whether this caused a failure in sending a push to a user? b. Why the socket got closed?

I saw https://github.com/ostinelli/apnotic/issues/73 but this seems to be irrelevant to our case since we're using 1.7.0 ..

Thanks!

mcfoton commented 2 years ago

From what I discovered

  1. We should be using a connection pool with on: :error handler, the example is in the docs.
  2. Default timeout of http-net2 is 60 seconds. After this time the response = connection.push(note) will return nil
  3. Connection pool will reestablish connection on timeout, but will not try to send the notification again, this should be handled manually.

Relevant

RLSWE commented 2 years ago

Thanks, @mcfoton