0 Replies Latest reply on Oct 26, 2004 7:59 PM by trosenbaum

    TemporaryTopic Leak or Hung Client with HTTPIL

    trosenbaum

      Environment: JBoss 3.2.6/JDK 1.4_05/Win2K Server/JMS using HTTPIL

      Scenario: A client creates and subscribes to a temporary topic. The
      client then exits without deleting the temporary topic.

      Problem: The temporary topic still exists on the server (leaked) along
      with any unclaimed messages and any future messages posted to that topic.

      Investigation Details:

      Due to the asynchronous nature of the HTTPIL connection, there is no way for
      the server to directly detect demise of a client and clean up temporary
      destinations created by that client. Any temporary destinations left behind
      by a client upon exit are leaked (along with any messages left on those
      destinations).

      One can plug in a ClientMonitorInterceptor to time out inactive connections,
      which will effect cleanup of temporary destinations, but this is not without
      its own problems.

      Timing out a connection by this means does invoke the asynchClose() method on
      the Connection bject on the client. But, that method does nothing. So, there
      is no way for the HTTPClientILService.run() method to detect that the connection
      has been closed (in the case where the connection is closed but the client is
      still receiving on it). Further, the HTTPClientILService.run() method does not
      check to see if the Connection has closed anyway. The HTTPClientILService.run()
      continues looping making calls to the HttpILServerServlet to pick up any waiting
      messages even after the ClientConnectionMonitor has closed the connection. The
      result is that the client is unable to detect closure of the connection and
      does not receive a failure notification from the receive call as might be
      expected.

      Another issue is that the HTTPIL does not implement pings so there is no
      automatic way to keep the connection alive if there is no traffic on
      the connection (on a dormant connection, the ClientMonitorInterceptor
      would eventually close the connection). Setting the PingPeriod in the
      jboss-service.xml service descriptor is ineffective due to the following
      overriding code in HTTPServerILService.startService() :

      public void startService() throws Exception
      {
      super.startService();
      this.pingPeriod = 0; // We don't do pings.
      //...
      }

      Comments:

      If a "ping" of some sort is to be performed, it becomes the responsibility
      of the client application.

      Perhaps more desirable beahvior would be:

      1) Connection-managed pinging to be supported for HTTPIL
      2) Some means of notifying a listening consumer that the connection has timed
      out - why should a consumer be allowed to invoke the HTTPIlServerServlet and
      wait for messages that will never come (because the connection has been closed)

      Questions:

      Is this behavior to be considered a bug in the HTTPIL implementation, or
      merely an inconvenience that I should be able to devise a workaround for?

      Any suggestions on how best to handle this problem?