vapor / apns

Helpful extensions and abstractions for using APNSwift
MIT License
115 stars 30 forks source link

Connection deadlock after random time #23

Closed xiao99xiao closed 3 years ago

xiao99xiao commented 3 years ago

I'm using APNS with TLS-based Auth, sending pushes every several minutes to only one device. But I notice that, often, after several hours(Time is completely random), The apns connection will be completely jammed, throwing the error below every time:

[ ERROR ] Connection request timed out. This might indicate a connection deadlock in your application.

After some investigation, I found there is a closed issue on APNSwift https://github.com/kylebrowning/APNSwift/issues/90 indicating such error might be caused by a wrong implementation for the reconnection part, and the error message is imported into AsyncKit lately https://github.com/vapor/async-kit/commit/7457413e57dbfac762b32dd30c1caf2c55a02a3d .

tanner0101 commented 3 years ago

Hey @xiao99xiao, thanks for reporting! Would it be possible to share some code here to help us get a reproduction going? The deadlock error in particular most often comes from an issue in the application code causing more connections to be used to once than the pool can handle. However, it could also be due to an issue with the pool internally. Getting a local repro will help to diagnose.

xiao99xiao commented 3 years ago

@tanner0101 I've investigated the issue for some time and seems it's a bug or logical issue of APNSwift. I'm post a issue here https://github.com/kylebrowning/APNSwift/issues/93 The reason is pretty clear for me, but I've no idea how to get it fixed.

kylebrowning commented 3 years ago

@tanner0101 @xiao99xiao It sounds like we need to implement a timeout, and re-send functionality no?

xiao99xiao commented 3 years ago

Close this issue since Apple resolved this on their side.

Andrewangeta commented 3 years ago

@xiao99xiao Can you link what Apple did or said about this?

kylebrowning commented 3 years ago

@Andrewangeta I can answer to that, it was done through private channels and relayed to me via email. Apple hasn't released any official statement about the fix.

https://github.com/jchambers/pushy/issues/816#issuecomment-715927935