-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Apns notification error: 'ConnectionError' System.NullReferenceException #672
Comments
Beside this, sometimes I get the following exception, also in OnNotificationFailed: System.ArgumentException: Source array was not long enough. Check srcIndex and length, and the array's lower bounds. Am I doing something wrong or misunderstanding the concept, or could this happen due to a bug? |
Same happens for me. Looks like problem is in |
any update on this. I am getting the same issue right here. |
@iinke I have a lock statement around the method that it is queening the device tokens. I am also creating batches and Queue device tokens in a timer. So in each 3 seconds I am queering 100 devices. But I am still getting this connection error. |
Didnt get it. Is it a bug or am I also doing something wrong? |
@gabrieligbastos it is a bug. Why this error is coming ? |
I have no clue why? It is just sometimes it just give me back this exception. Seems randomly, Could not find a situation that always happens. Before update my NugetPackage to the new version, it was not getting this error. |
Any update to workaround this? |
I too have the same issue : Connection Error public static void SendNotifications(List currentBrandNotications, long brandId)
Thanks in advance. |
@iinke any updates on this? I experienced this when dealing with a larger batch of notifications. I open the broker and send notification on a separate thread. Could this be the issue? Do you suggest I run the service on the main thread? The following are exceptions logged: Initially one for every notification:
followed by a bunch of:
|
@Redth Just checking if there are any updates on this issue. I am experiencing this even with a single broker. Would be great to understand what is going on. Any help would be appreciated. Thanks |
I had this problem too. I solved it by checking the Push sharp (verbose) logging by setting:
It showed the error "Missing Push Token". And because I had a device without a (valid) pushtoken on top of my queue, the APNS server disconnected (all) connection(s) without question. |
@tweek82 Thanks for your reply. How did you dequeue the device? |
I check the push token before I add it to the queue. When token is invalid I directly update the devive in my database by just deleting it. |
I am cleaning the expired devices using the FeedbackService class before I On 4 October 2016 at 16:22, tweek82 notifications@github.com wrote:
|
Nothing fancy, just check IsNullOrWhitespace before queue'ing. Like this:
|
Hmm, ok so you had an empty device token for the device. I guess I'll have to enable the log to monitor what the issue is in my case as I cannot see a reason why my token would be empty or null. I only insert them when the user registers for push notifications from the device. So you used the following to enable logging...
I'll give it a go. Thanks for your help and swift replies 👍 |
No problem. Please share any of your apns-troubles and solutions. It might help me and others too. |
Will do, once again thanks for your help @tweek82 |
Apns notification error: 'ConnectionError' |
IIS Express is Succeeded and IIS is Failed |
I am getting frequently connection error while sending Push to iOS. "Failed to Connect, check your firewall settings! at PushSharp.Apple.ApnsConnection.d__25.MoveNext() Please advice on resolution. Thanks in Advance. |
Hello, I seem to be getting the same problem; I send 100 notifications and nothing is wrong, but when one of the tokens is wrong, Ialso get this exception often: Will insert code but keep in mind a lot of variables are useless, just using them to try to catch the problem... `using System; namespace PlaneSeats
//--------------------------------FOR LOOP. STARTS HERE--------------------------------------------------------------------------------------
//--------------------------------FOR LOOP. ENDS HERE-------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------------------------------------------- } Thanks! |
fixed this problem by setting config.internalBatchSize = int.MaxValue; |
Same issue here, I think I might have fixed it by locking notificationBatchQueueLock around the dequeueing, like this:
|
Maybe this problem can occur when the token is in invalid format. |
I get the same error running the service in Azure WebApp. Same code works fine on my laptop. |
I'm using PushSharp 4.0.4, installed from NuGet
In the OnNotificationFailed(ApnsNotification, AggregateException) event of the Apns broker, I often get this exception:
PushSharp.Apple.ApnsNotificationException: Apns notification error: 'ConnectionError'
---> System.NullReferenceException: Object reference not set to an instance of an object.
at PushSharp.Apple.ApnsConnection.createBatch(List`1 toSend)
at PushSharp.Apple.ApnsConnection.d__21.MoveNext()
--- End of inner exception stack trace ---
at PushSharp.Apple.ApnsServiceConnection.d__2.MoveNext()
It seems to happen randomly. I'm using PushSharp in a Windows Service, running multiple (>300) brokers in the same time stored in a singleton object's ConcurrentDictionary, if that helps.
Please advise how to troubleshoot this error.
The text was updated successfully, but these errors were encountered: