AMANZATECH / apns-sharp

Automatically exported from code.google.com/p/apns-sharp
0 stars 0 forks source link

NotificationService.Close() immediately after a NotificationService.QueueNotification() will discard the Notification #41

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a NotificationService
2. Call QueueNotification on the Service
3. Call Close / Dispose on the Service

What is the expected output? What do you see instead?
I expect the Message to be Processed, but it seems like it is just thrown away.

What version of the product are you using? On what operating system?
1.0.3.0, Windows Vista 32Bit

Please provide any additional information below.
It might have something to do with the Close from NotificationConnection and 
the workerThread and some RaceCondition.

Original issue reported on code.google.com by r.baeriswyl on 25 Nov 2010 at 9:44

GoogleCodeExporter commented 8 years ago
im seeing this too.

Original comment by mikeyhar...@gmail.com on 26 Nov 2010 at 3:41

GoogleCodeExporter commented 8 years ago
Just to add - im using the source from the trunk - Ive noticed that if I 
initialise the NotificationService obj in the constructor, then  call upon it 
when there are notificiations to send, it throws an exception. Yet if i 
initialise it directly before Im sending an alert the the queue, it works.?

Original comment by mikeyhar...@gmail.com on 26 Nov 2010 at 4:29

GoogleCodeExporter commented 8 years ago
I am seeing this as well. Looking at the NotificationConnection.Close() method 
i found this:

// Sleep here to prevent a race condition
// in which a notification could be queued while the worker thread
// is sleeping after its loop, but if we set closing true within that 100 ms,
// the queued notifications during that time would not get dequeued as the loop
// would exit due to closing = true;
// 250 ms should be ample time for the loop to dequeue any remaining 
notifications
// after we stopped accepting above
Thread.Sleep(250);

And in the loop mentioned i found:
Thread.Sleep(500);

Setting the sleep time in the close method to 1000 fixed it for me ;)

Original comment by olavr...@gmail.com on 28 Nov 2010 at 6:33

GoogleCodeExporter commented 8 years ago

Original comment by jond...@gmail.com on 14 Feb 2011 at 7:45

GoogleCodeExporter commented 8 years ago

Original comment by jond...@gmail.com on 14 Feb 2011 at 7:45

GoogleCodeExporter commented 8 years ago
I did same but i m still having this problem..

Original comment by subu1985...@gmail.com on 29 Nov 2013 at 1:24