none
Application is getting disappeared from cepServer.Applications list

    Question

  •  using (Server cepServer = Server.Connect(endpointAddress))
                    {
                        StartAppAndQueries(cepServer);
                        Console.WriteLine("Startup completed.");
                        Console.WriteLine("Enter D to delete the application");
                        if (Console.ReadLine() == "D")
                        {
                            DeleteApplication(cepServer);
                        }
                    }

    The above code is copied from: DevBiker.SimpleSIApp solution. After starting the application, wait for around 10 minutes and click "D" in console to delete the Application.
    I am getting exception saying that key is not found. I debugged the code and found that: the
    cepServer.Applications does not have any applications. I am surprised to see this.. my application is running.. so at least he collection should contain my application.
    This happens only after some time, after starting the application. Any idea how the running application is getting removed from the cepServer.Applications collection? is there a bug in StreamInsight? (I am using 1.2 version)


    Venkat

    Wednesday, February 29, 2012 7:19 AM

Answers

  • Not that I can tell. The underlying WCF service is hidden pretty deep in the API and private. In a real-world app (as opposed to a simple demo app), I would suggest putting some sort of background timer in place to make a call across the wire to make sure that you don't time out. And error handling around it.

    You could, however, always make a suggestion on Microsoft Connect. The product team does watch this closely and takes the submissions and feedback seriously.


    DevBiker (aka J Sawyer)
    My Blog
    My Bike - Concours 14


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.


    • Edited by DevBikerMVP Tuesday, March 06, 2012 3:14 PM
    • Marked as answer by Stephanie Lv Monday, March 19, 2012 7:45 AM
    Tuesday, March 06, 2012 3:14 PM

All replies

  • I ran the same sample you are referring to but don't see the behaviour you are seeing.

    What happens if you put breakpoints on all Dispose methods in the sample and set breakpoints on exceptions as well. I'd be interested to see if any of those get hit.

    Wednesday, February 29, 2012 3:19 PM
  • Hi,

    Keep it running for about 10 minutes (don't enter "D" button, before 10 minutes).

    yes, when I debugged (i have put a breakpoint at: DeleteApplication(cepServer);) it showed that Applicaitons collections does not contain any applicaitons !!!

    Yes, i have set breakpoints on exceptions as well.

    In your case you kept it running for about 10 minutes and verified? And it is not consistant, so it is difficult to tell in what scenario this happens. I will let you know if I can find a pattern in reproducing this.. thanks.


    Venkat

    Thursday, March 01, 2012 5:12 AM
  • Hi,

    I got the erro now after 30 minutes of running the application. please see the images attached.

    Exception details:

    System.Collections.Generic.KeyNotFoundException was unhandled
      Message=The given key was not present in the dictionary.
      Source=Microsoft.ComplexEventProcessing.Diagnostics
      StackTrace:
           at Microsoft.ComplexEventProcessing.Diagnostics.Exceptions.Throw(Exception exception)
           at Microsoft.ComplexEventProcessing.CepObjectReadOnlyDictionary`1.get_Item(String key)
           at Microsoft.ComplexEventProcessing.CepObjectReadOnlyDictionary`1.System.Collections.Generic.IDictionary<System.String,T>.get_Item(String key)
           at DevBiker.SimpleSIApp.Program.DeleteApplication(Server cepServer) in C:\...\StreamInsight\SimpleStreamInsightApp\C#\SimpleInProcOutOfProc\Program.cs:line 107
           at DevBiker.SimpleSIApp.Program.Main(String[] args) in C:\..\StreamInsight\SimpleStreamInsightApp\C#\SimpleInProcOutOfProc\Program.cs:line 93
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:


    Venkat


    • Edited by VenkatABC Thursday, March 01, 2012 6:39 AM
    Thursday, March 01, 2012 6:37 AM
  • Yes, I ran it for 10 minutes previously. I'll run it for 30 minutes given this most recent result and let you know what happens here
    Thursday, March 01, 2012 11:23 AM
  • I don't get your result. Just ran it for 45 minutes and it was still fine when I shutdown using the 'D' command
    Thursday, March 01, 2012 12:09 PM
  • Does this happen when you are running the embedded server or when you are running the remote server?

    If remote, have you connected to the server from the query debugging just before you type "D"?


    DevBiker (aka J Sawyer)
    My Blog
    My Bike - Concours 14


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Thursday, March 01, 2012 5:16 PM
  • I am running this on Remote Server. I am NOT using the Embeded server.

    "If remote, have you connected to the server from the query debugging just before you type "D"? " --> I did not stop the client to connect again. my cepServer object is still alive, and so I expect the SI meta data in it.


    Venkat

    Sunday, March 04, 2012 12:03 PM
  • I understand what you expect - I was asking what additional steps for debugging that you have done.

    Now, here's what's happening. First, you need to remember that StreamInsight is remote ... it's connecting via a WCF service. This WCF service is using sessions. After a period of inactivity, the session times out and you need to reconnect.


    DevBiker (aka J Sawyer)
    My Blog
    My Bike - Concours 14


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Sunday, March 04, 2012 4:06 PM
  • Some more information on the session timeout. Note that there is a timeout whether or not Reliable Sessions are used. From the WCF documentation:

    When using a reliable session, there are two different inactivity timers that must be satisfied to keep the connection alive. If either of these inactivity timers goes off, then the connection is dropped.

    • The first inactivity timer is on the reliable session and is called the InactivityTimeout. This inactivity timer fires if no messages, either application or infrastructure, are received within the timeout period. An infrastructure message is a message that is generated for the purpose of one of the protocols in the channel stack, such as a keep alive or an acknowledgment, rather than containing application data.

    • The second inactivity timer is on the service and uses the ReceiveTimeout setting of the binding. This inactivity timer fires if no application messages are received within the timeout period. This specifies, for example, the maximum time a client may take to send at least one message to the server before the server will close the channel used by a session. This behavior ensures that clients cannot hold on to server resources for arbitrary long periods.

    Since the connection is dropped if either inactivity timer fires, increasing InactivityTimeout once it is greater than ReceiveTimeout has no effect. The default for both of these timeouts is 10 minutes, so you always have to increase both of them to make a difference when using a reliable session.

    If transaction flow is enabled on the binding or the channel, the operation may take longer to execute than the specified timeout. In these circumstances the operation fails due to the expired timeout and the transaction aborts appropriately.


    DevBiker (aka J Sawyer)
    My Blog
    My Bike - Concours 14


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Monday, March 05, 2012 10:38 PM
  • DevBiker,

    I see your point about WCF Session.

    But I thought the SI client software knows to connect back to server when we try to access SI meta data.

    Is there a way to know my SI client is connected to server or not? I don't see any Status property on the Server object.


    Venkat

    Tuesday, March 06, 2012 8:59 AM
  • Not that I can tell. The underlying WCF service is hidden pretty deep in the API and private. In a real-world app (as opposed to a simple demo app), I would suggest putting some sort of background timer in place to make a call across the wire to make sure that you don't time out. And error handling around it.

    You could, however, always make a suggestion on Microsoft Connect. The product team does watch this closely and takes the submissions and feedback seriously.


    DevBiker (aka J Sawyer)
    My Blog
    My Bike - Concours 14


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.


    • Edited by DevBikerMVP Tuesday, March 06, 2012 3:14 PM
    • Marked as answer by Stephanie Lv Monday, March 19, 2012 7:45 AM
    Tuesday, March 06, 2012 3:14 PM