jchambers / pushy

A Java library for sending APNs (iOS/macOS/Safari) push notifications
https://pushy-apns.org/
MIT License
1.81k stars 450 forks source link

"TooManyProviderTokenUpdates" received when sent a push notification to apns using .p8 #568

Closed JackZhangOnly closed 4 years ago

JackZhangOnly commented 6 years ago

I was using the pushy library.

"TooManyProviderTokenUpdates" received when sent a push notification to apns using .p8 file.

[https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1] This document indicates that "TooManyProviderTokenUpdates" means The provider token is being updated too often.

But i am still confused,What does that mean ? The provider token is being updated by what ?

What's right solution? Any reply is appreciated,Thanks very much.

jchambers commented 6 years ago

The "provider token" is the authentication token derived from your private key (the one in the .p8 file). Tokens expire after an hour, and so they need to be regenerated. TooManyProviderTokenUpdates indicates this is happening more often than expected.

You're the first person to report this problem, and so I suspect it is not a widespread bug. Can you please share more information about your setup and your approach to sending push notifications? My suspicion is that you are, for example, creating a new ApnsClient for each push notification, or have set an extremely high concurrency level.

jchambers commented 6 years ago

Closing due to lack of information. @JackZhangOnly please leave a comment if you have any additional information and we'll happily reopen this issue.

hjhstanley commented 5 years ago

i met the same problem. my implementation updates the provider token every 50 minutes, and there are two process running, so it will trigger twice every 50 minutes. and then i get 429 carrying TooManyProviderTokenUpdates every few days

hjhstanley commented 5 years ago

@jchambers

jchambers commented 5 years ago

my implementation updates the provider token every 50 minutes

I'm confused; Pushy doesn't make that behavior configurable. Can you say more about what you're doing to update the provider token?

Also, as a general note, you do not need to tag me directly on issues or pull requests.

hjhstanley commented 5 years ago

my implementation updates the provider token every 50 minutes

I'm confused; Pushy doesn't make that behavior configurable. Can you say more about what you're doing to update the provider token?

Also, as a general note, you do not need to tag me directly on issues or pull requests.

thank you for your help and i'm sorry for tagging you.

and what we're doing is : there are several servers in which there are several process running the push application, using .p8 based authentication. Each process maintains one connection with APNS. Each process maintains respective jwt token, and rotates it every 50 minutes.

jchambers commented 5 years ago

Each process maintains respective jwt token, and rotates it every 50 minutes.

Right; I think this is the part where we're not on the same page. How do you tell each process to rotate its tokens every 50 minutes?

hjhstanley commented 5 years ago

Each process maintains respective jwt token, and rotates it every 50 minutes.

Right; I think this is the part where we're not on the same page. How do you tell each process to rotate its tokens every 50 minutes?

there is timer in each process, when 50 minute reaches, each process rotate it's token, respectively.

hjhstanley commented 5 years ago

pardon me. i finally realize that this is the pushy page, and i didn't use the library... sorry for my disturbance.

jchambers commented 4 years ago

Okay—now I've seen this in the real world, so I'm convinced it's A Thing. We saw a flurry of TooManyProviderTokenUpdates followed by a long run of "token has expired." I'll dig in.

kicktipp commented 2 years ago

Is this really fixed? We use pushy 0.15.0 and are getting lots of errors of this type. We use pushy in our cluster of 20 application servers. I would expect to happen after restart of the cluster when 20 clients connect. But this is not the case. There can't discover any pattern yet.

This error occurs since updating from 0.14.2

jchambers commented 2 years ago

@kicktipp Let's move this discussion to #931, which is both open and more specifically about Pushy 0.15. That said, I'll have the same question for you as the original poster: can you please share debug logs so we can figure out what's going on here?