2 Replies Latest reply on Feb 4, 2010 6:53 AM by Pradeep.Ch

    Error in logout from channel in Flex 4

    Pradeep.Ch

      Hi,

       

      We are building our application on Flex 4 and LCDs 3.  The application uses RTMP protocol to communicate to the server. Request for application server is routed through Edge server sitting in DMZ. For implementing the logout functionality, I am invoking logout on the RTMP channel.

       

      The problem occurs when I try to login and logout more than 2 times. For first two attempts of login-logout, it works as expected. But on third attempt an error related to invalid FlexSession is displayed on Edge Server console. No request is forwarded to appln. server

       

      Following is the logout logic

              public function logout() : void{

                  asyncConsumer.unsubscribe();

                  var token:AsyncToken = asyncConsumer.channelSet.logout();

                  asyncConsumer.disconnect();

                  token.addResponder(new AsyncResponder(logoutSuccessCallback, logoutErrorCallback));
              }

       

              private function logoutErrorCallback(event : FaultEvent, token : AsyncToken = null) : void {
                  mx.controls.Alert.show("Unexpected error during log out.", "Error");
              }
             
              private function logoutSuccessCallback(event : ResultEvent, token : AsyncToken = null):void {
                  mainTabNavigator.removeAll();
                  callLater(showLoginPrompt, [null]);
              }

       

      I have not been able to figure out why do I get Invalid FlexSession error third time ? What extra statements need to be added to clear the Flex Session infomation from the client.

       

      Following is the error log on edge server for 3rd attempt to login after logout:

       

      [LCDS]02/02/2010 20:22:41.395 Thread[my-rtmp-SocketServer-Reactor2,5,main] Connection '1627493955' starting a write.
      [LCDS]02/02/2010 20:22:41.396 Thread[my-rtmp-SocketServer-Reactor2,5,main] Connection '1627493955' finished a write. 416 bytes were written.
      [LCDS]02/02/2010 20:22:48.304 Thread[my-rtmp-SocketServer-Reactor2,5,main] unregistering read interest for Connection '1627493955'.
      [LCDS]02/02/2010 20:22:48.304 Thread[my-rtmp-SocketServer-WorkerThread-34,5,main] Connection '1627493955' starting a read.
      [LCDS]02/02/2010 20:22:48.304 Thread[my-rtmp-SocketServer-WorkerThread-34,5,main] received message TCMessage [ Type: MsgCmdEx, Stream ID: 0]
      [LCDS]02/02/2010 20:22:48.305 Deserializing AMF/RTMP request
      Version: 3  null
        13.0

       

        (Command method=null (0) trxId=13.0)
          null
          (Typed Object #0 'flex.messaging.messages.CommandMessage')
            operation = 8
            correlationId = ""
            messageId = "CC4CC8F4-9CF2-7601-5501-8F2690891BFF"
            body = "dGVzdHVzZXIxNTpQVVRfSEFTSEVEX1BBU1NXT1JEX0hFUkU="
            timestamp = 0
            timeToLive = 0
            destination = ""
            clientId = null
            headers = (Object #1)
              DSId = "238713B7-0429-8BFE-5857-BE24EDBB9865"

       

      [LCDS]02/02/2010 20:22:48.305 Received command: TCCommand [ Cmd: 0, MethodName: null, TrxID: 13.0]
      [LCDS]02/02/2010 20:22:48.307 Thread[my-rtmp-SocketServer-WorkerThread-34,5,main] failed to read Connection '1627493955' or process the data; Connection is in the 'Open' state and will be forced closed.
      flex.messaging.LocalizedException: The FlexSession is invalid.
              at flex.messaging.FlexSession.checkValid(FlexSession.java:946)
              at flex.messaging.FlexSession.addSessionDestroyedListener(FlexSession.java:410)
              at flex.messaging.client.FlexClient.registerFlexSession(FlexClient.java:1126)
              at flex.messaging.endpoints.AbstractEndpoint.setupFlexClient(AbstractEndpoint.java:1065)
              at flex.messaging.endpoints.AbstractEndpoint.setupFlexClient(AbstractEndpoint.java:1036)
              at flex.messaging.endpoints.RTMPConnection.handleTCCommandIn(RTMPConnection.java:772)
              at flex.messaging.endpoints.RTMPConnection.in(RTMPConnection.java:933)
              at flex.messaging.endpoints.RTMPConnection.serviceTCMessage(RTMPConnection.java:1020)
              at flex.messaging.endpoints.RTMPConnection.doRead(RTMPConnection.java:561)
              at flex.messaging.endpoints.RTMPProtocolHandler.doRead(RTMPProtocolHandler.java:125)
              at flex.messaging.socketserver.Connection$ConnectionReader.run(Connection.java:848)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
              at java.lang.Thread.run(Thread.java:619)

       

      [LCDS]02/02/2010 20:22:48.309 Thread[my-rtmp-SocketServer-WorkerThread-34,5,main] Connection '1627493955' has changed state to: Closing
      [LCDS]02/02/2010 20:22:48.309 Thread[my-rtmp-SocketServer-WorkerThread-34,5,main] closing Connection '1627493955'.
      [LCDS]02/02/2010 20:22:48.309 Thread[my-rtmp-SocketServer-WorkerThread-34,5,main] Connection '1627493955' has changed state to: Closed
      [LCDS]02/02/2010 20:22:48.309 Thread[my-rtmp-SocketServer-WorkerThread-34,5,main] closed Connection '1627493955'.
      [LCDS]02/02/2010 20:22:48.309 Thread[my-rtmp-SocketServer-WorkerThread-34,5,main] Connection '1627493955' finished a read. 300 bytes were read.
      Exception in thread "my-rtmp-SocketServer-WorkerThread-34" java.lang.NullPointerException
              at flex.messaging.endpoints.rtmp.RTMPFlexSession.unsetConnection(RTMPFlexSession.java:201)
              at flex.messaging.endpoints.RTMPProtocolHandler$DirectRTMPConnection.close(RTMPProtocolHandl er.java:316)
              at flex.messaging.endpoints.RTMPConnection.close(RTMPConnection.java:219)
              at flex.messaging.endpoints.RTMPProtocolHandler.closed(RTMPProtocolHandler.java:101)
              at flex.messaging.socketserver.Connection.closeImmediate(Connection.java:436)
              at flex.messaging.socketserver.SSLConnection.closeImmediate(SSLConnection.java:145)
              at flex.messaging.socketserver.Connection$ConnectionReader.run(Connection.java:903)
              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
              at java.lang.Thread.run(Thread.java:619)

       

       

      Thanks in advance