-
Notifications
You must be signed in to change notification settings - Fork 96
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
Using Apnotic::ConnectionPool with Sidekiq is unsafe #69
Comments
Thank you for reporting this! Care to issue a PR for both of your points? |
I could do that, do you have any preference on the API for this? |
One option is to allow users to set a connection after the initialization on the connection pool: APNOTIC_POOL = Apnotic::ConnectionPool.new({
cert_path: Rails.root.join("config", "certs", "apns_certificate.pem"),
cert_pass: "mypass"
}, size: 5).do |connection|
connection.on(:error) { |exception| puts "Exception has been raised: #{exception}" }
end Still thinking whether we should set this by default or not on: What do you think? |
My feeling is that it should be required so user can decide how to deal with those errors. I'm sure that for the most of the production systems, some kind of exception tracking tool is used (Rollbar/Bugsnag/Honeybadger/etc) so it could be utilized accordingly. I created a PR, let me know what you think |
Merged, thank you for your help. |
From net-http2 documentation:
But the problem is that
Apnotic::ConnectionPool
does not allow callingon
on actualApnotic::Connection
to pass in the error handler.Here's example scenario that leads to lost jobs - we've been seeing this in production for quite some time now but couldn't point a finger on it, but thanks to #68 it's got easily reproducible:
SocketError
or similarSocketError
is raised on a main threadHere is an example report of this exact behavior: sidekiq/sidekiq#3886
I think apnotic should definitely do a better job here to improve reliability and also stop suggesting unsafe usage in documentation. Here's what I would suggest:
Apnotic::ConnectionPool
Currently we work this around by creating a pool manually:
Please let me know if there are any thoughts. Thanks!
The text was updated successfully, but these errors were encountered: