Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

bug: Add connection timeouts for APNS #1394

Closed
wants to merge 5 commits into from
Closed

bug: Add connection timeouts for APNS #1394

wants to merge 5 commits into from

Conversation

jrconlin
Copy link
Member

@jrconlin jrconlin commented May 16, 2020

Closes #1393

Description

I don't believe that these connections are being closed, and eventually we wind up with old, mostly idle connections that Apple frowns upon. Also, APNS is not really "heavy use" so we can probably turn off the pre-connection pool and just connect when need be.

TODO:
find a better reaper than just calling out to Thread.

Testing

There are unit tests. With debugging enabled, idle connections should time out after about 5 min.

Issue(s)

Closes #1393.

@jrconlin jrconlin requested a review from a team May 16, 2020 00:08
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2020

Codecov Report

Merging #1394 into master will decrease coverage by 0.01%.
The diff coverage is 97.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1394      +/-   ##
==========================================
- Coverage   99.74%   99.72%   -0.02%     
==========================================
  Files          64       64              
  Lines       10476    10537      +61     
==========================================
+ Hits        10449    10508      +59     
- Misses         27       29       +2     
Impacted Files Coverage Δ
autopush/router/apns2.py 98.07% <95.65%> (-1.93%) ⬇️
autopush/router/apnsrouter.py 100.00% <100.00%> (ø)
autopush/tests/test_router.py 99.90% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 00aaab4...0e494b9. Read the comment docs.

autopush/router/apns2.py Show resolved Hide resolved
autopush/router/apns2.py Show resolved Hide resolved
autopush/router/apns2.py Outdated Show resolved Hide resolved
@jrconlin
Copy link
Member Author

NOTE: going to ice this PR for the time being.

After discussions with @pjenvey, this hack may work, but what's really needed is more visibility into whatever error may actually be occurring. The HTTP2 library we use is fairly robust and should be able to handle any invalid state naturally.

Keeping this PR and branch in reserve in case it's needed.

jrconlin added a commit that referenced this pull request Jun 25, 2020
Issue #1393 notes, sending push messages across APNS seems to work
great after a deploy, but then degrades after a week or so. #1394 is
a possible work-around (by double-pooling connections and using a
dedicated connection terminator), but it's messy and hacky.

What's really needed is a bit more visibility into what may be
happening, and that will involve logging all APNS communication
exceptions reliably.

Issue #1393
@jrconlin jrconlin marked this pull request as draft June 25, 2020 19:53
jrconlin added a commit that referenced this pull request Jul 1, 2020
Issue #1393 notes, sending push messages across APNS seems to work
great after a deploy, but then degrades after a week or so. #1394 is
a possible work-around (by double-pooling connections and using a
dedicated connection terminator), but it's messy and hacky.

What's really needed is a bit more visibility into what may be
happening, and that will involve logging all APNS communication
exceptions reliably.

Issue #1393
@tublitzed tublitzed closed this Jul 27, 2020
@jrconlin jrconlin deleted the bug/1393 branch October 7, 2020 23:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add connection timeouts for HTTP2 connections to APNs
4 participants