New Posts New Posts RSS Feed: Notification service won't unsubscribe
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Notification service won't unsubscribe

 Post Reply Post Reply
Author
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Topic: Notification service won't unsubscribe
    Posted: 16-Feb-2012 at 7:08am
Hello,
I've started looking with fiddler the traffic I've with my WPF application... I've noticed then when I close the application but don't stop the server (what it normally should be in a real production server) I have the NotificationService that continues to send message even if I've called the  Manager.CancelCallback...

my code is :

Repository :

public void RegisterCallBack(string serviceTypeName, string serviceMethodName, Action<SubscriptionOperation> callback, object userToken, params object[] clientArgs)

   {

       try

       {

           Manager.RegisterCallback(serviceTypeName, serviceMethodName, callback, userToken, clientArgs);

       }

       catch (Exception ex)

       {

           //todo : add logging

       }

   }

 

   public void CancelCallBack(object userToken)

   {

       try

       {

           Manager.CancelCallback(userToken);

       }

       catch (Exception ex)

       {

           //todo : add logging

       }

   }


(no exception are thrown BTW)

on the BootStrapper :

     protected override void OnExit(object sender, EventArgs e)
        {
            base.OnExit(sender, e);

            if (repository != null)
            {
                repository.CancelCallBack(UserMessagesViewModel.NOTIFICATION_TOKEN);
            }

        }

In my UserMessageViewModel I subcribe as

private void SubscribeNotification()

    {

 

        if (isSubscribed)

        {

            repository.CancelCallBack(NOTIFICATION_TOKEN);

        }

 

        var objArray = new object[] { repository.GetLoggedUser(), FilterAncheVisti };

 

        repository.RegisterCallBack(NOTIFICATION_SERVICE_PATH, NOTIFICATION_SERVICE_METHOD, UserMessagePushCallback, NOTIFICATION_TOKEN, objArray);

 

        isSubscribed = true;

 

    }


What can I do wrong?


Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 783
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 16-Feb-2012 at 4:39pm
Hi Paolo,
 
I was not able to reproduce the issue here.
I have tested using DevForce 6.1.5.1. What version of DevForce are you using?
 
I did some testing with our WPF Push Notification sample and here's the outcome:
 
Once a client calls CancelCallback, the server should register in its DebugLog:
IdeaBlade.EntityModel.Server.NotificationServiceManager:UnregisterUser - User unregistered from _Service Name_
 
Once all clients subscribing to the notification service unsubscribe to it, the server will stop the notification service:
IdeaBlade.EntityModel.Server.NotificationThreadHelper:StopThread - Stopping thread for _Service Name_
IdeaBlade.EntityModel.Server.NotificationServiceManager:NotificationThreadCompleted - Server method completed: _Service Name_
I also verified that if the user closes the client app without unsubscribing to the service, the server will eventually remove the subscriber after a timeout: (1 min default)
IdeaBlade.EntityModel.Server.NotificationServiceManager:AsyncNotify - Removing subscriber after error The message could not be transferred within the allotted timeout of 00:01:00. There was no space available in the reliable channel's transfer window. The time allotted to this operation may have been a portion of a longer timeout.
 
 
As for not unsubscribing upon calling CancelCallback, it can only think of not having the right token. Could you verify that the token is accurate?
Also, could you ensure there are no other subscribers to the notification service? (notificationManager.GetSubscribers(serviceKey).Count())
 
Regards,
   Silvio.
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 16-Feb-2012 at 11:30pm
Hello Silvio..... I've not found the DevForce 6.1.5.1 from the avaiable downloads.. where can I download it?
I'll check the logs and the GetSubScribers(....)
Let you know thanks
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 783
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 17-Feb-2012 at 10:56am
Paolo,
DevForce 6.1.5.1 is the latest varsion availble. You will be able to download it in our Customer Portal.
 
Silvio.
Back to Top
mitchell_bu View Drop Down
Newbie
Newbie


Joined: 23-Feb-2012
Posts: 10
Post Options Post Options   Quote mitchell_bu Quote  Post ReplyReply Direct Link To This Post Posted: 23-Feb-2012 at 7:37am
pponzano, did upgrading to 6.1.5.1 fix your problem?  I have a Silerlight application with 6.1.4.0 and am having a similar issue.  It only surfaced when using the Silverlight 5 runtime.  When the application is closed, the notification service subscription remains active even though we explicitly unsubscribe in the Application.Exit event.  This results in the browser process (IE, firefox,etc) to never release its resources.
Back to Top
pponzano View Drop Down
Senior Member
Senior Member
Avatar

Joined: 28-Apr-2011
Location: Italy
Posts: 165
Post Options Post Options   Quote pponzano Quote  Post ReplyReply Direct Link To This Post Posted: 23-Feb-2012 at 8:01am
Hello mitchel_bu, I've not upgraded to .5.1 but I've noticed that the subscribe is removed when I close the client, and there're one,two times (I think it's due to the fact it takes a little time to unsubscribe), I'll test in next days and let you know
Back to Top
mitchell_bu View Drop Down
Newbie
Newbie


Joined: 23-Feb-2012
Posts: 10
Post Options Post Options   Quote mitchell_bu Quote  Post ReplyReply Direct Link To This Post Posted: 22-Mar-2012 at 2:07pm
This seems to be a issue that refuses to die for us...
 
We upgraded to 6.1.6.0 and it fixed our initial issue.  It seemed that originally, when the browser was closed, the client was still holding onto a reference to the subscription, which wasn't allowing the process to release it's resources.  DevForce acknowledged this was a bug (Fixed a problem where the browser process would not terminate if a Silverlight application had an outstanding subscription to a Push service. [D1987]) and fixed it for 6.1.6.0.
 
However, even though the browser process now terminates, the service appears to never be notified that the client has closed and continues to run.  This is problematic for us because the service assumes the information it sends is being received and updates the database that the data has been sent to the client.  We could rearrange the code and have the client update the DB once it receives the notification, but I feel this is just putting on a bandaid as we will still have multiple instances of the service running, and will continue to run after the client closes.
 
I have tried handling the Application.Exit event and adding code to unsubscribe from all existing subscriptions just like pponzano, but haven't had any luck in it actually working.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down