Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-564

CommonsHttpMessageSender no longer properly shuts down MultiThreadedHttpConnectionManager

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5.9
    • Component/s: None
    • Labels:
      None

      Description

      As of revision 1414 of CommonsHttpMessageSender, the MultiThreadedHttpConnectionManager never gets it's shutdown method invoked.

      It appears that the prior revision of CommonsHttpMessageSender implemented DisposableBean, and invoked this properly.
      SWS-482 removed the destroy method to cope with a problem report, but the result is worse.

      If you use MultiThreadedHttpConnectionManager, you have to call it's shutdown method, or it will block application exit.
      For example, I have a class with a main method that uses WebServiceTemplate along with CommonsHttpMessageSender that is invoked via an ant task. The main method will complete, but the JVM cannot exit.

      Lets revisit SWS-482 and come up with a means for resolving the issue appropriately.
      The reporter of that issue mentions that:
      "it happens it is always after we redeploy our application (weblogic 9.2MP2)".

        Issue Links

          Activity

          nblair Nicholas Blair created issue -
          Hide
          nblair Nicholas Blair added a comment -

          The problem reported in SWS-482 is likely due to the following sequence of events (with the prior revision of CommonsHttpMessageSender):

          1. Customer tries to redeploy application using WebServiceTemplate and CommonsHttpMessageSender.
          2. redeploy results in first stopping application, which shuts down Spring application context.
          3. destroy in WebServiceTemplate results in CommonsHttpMessageSender#destroy
          4. CommonsHttpMessageSender destroy results in MultiThreadedHttpConnectionManager#shutdown
          5. Application shutdown, now started again by the container.

          I think the actual solution here isn't to remove DisposableBean (and the MultiThreadedHttpConnectionManager#shutdown) implementation on CommonsHttpMessageSender.

          One option might be to alter CommonsHttpMessageSender's afterPropertiesSet method - it should instantiate a new MultiThreadedHttpConnectionManager and supply it to the internal HttpClient.

          Show
          nblair Nicholas Blair added a comment - The problem reported in SWS-482 is likely due to the following sequence of events (with the prior revision of CommonsHttpMessageSender): 1. Customer tries to redeploy application using WebServiceTemplate and CommonsHttpMessageSender. 2. redeploy results in first stopping application, which shuts down Spring application context. 3. destroy in WebServiceTemplate results in CommonsHttpMessageSender#destroy 4. CommonsHttpMessageSender destroy results in MultiThreadedHttpConnectionManager#shutdown 5. Application shutdown, now started again by the container. I think the actual solution here isn't to remove DisposableBean (and the MultiThreadedHttpConnectionManager#shutdown) implementation on CommonsHttpMessageSender. One option might be to alter CommonsHttpMessageSender's afterPropertiesSet method - it should instantiate a new MultiThreadedHttpConnectionManager and supply it to the internal HttpClient.
          arjen.poutsma Arjen Poutsma made changes -
          Field Original Value New Value
          Fix Version/s 1.5.9 [ 11296 ]
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Good suggestions, I will take a further look at this for 1.5.9.

          Thanks!

          Show
          arjen.poutsma Arjen Poutsma added a comment - Good suggestions, I will take a further look at this for 1.5.9. Thanks!
          arjen.poutsma Arjen Poutsma made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          arjen.poutsma Arjen Poutsma made changes -
          Link This issue is related to SWS-482 [ SWS-482 ]
          arjen.poutsma Arjen Poutsma logged work - 10/Nov/09 12:43 AM
          • Time Spent:
            4h 5m
             
            <No comment>
          arjen.poutsma Arjen Poutsma made changes -
          Time Spent 4h 5m [ 14700 ]
          Remaining Estimate 0d [ 0 ]
          arjen.poutsma Arjen Poutsma made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          I reintroduced the shutdown() call, and also solved the problem reported in SWS-482.

          The underlying problem (in SWS-482) was that a connection was retrieved from the CommonsHttpMessageSender, the app context was closed resulting in a the connection pool shutdown, and then the connection was used, resulting in the IllegalStateException. Now, we create a new, single-use connection pool for that connection. Not pretty, but it works.

          Show
          arjen.poutsma Arjen Poutsma added a comment - I reintroduced the shutdown() call, and also solved the problem reported in SWS-482 . The underlying problem (in SWS-482 ) was that a connection was retrieved from the CommonsHttpMessageSender, the app context was closed resulting in a the connection pool shutdown, and then the connection was used, resulting in the IllegalStateException. Now, we create a new, single-use connection pool for that connection. Not pretty, but it works.
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Closing old issues

          Show
          arjen.poutsma Arjen Poutsma added a comment - Closing old issues
          arjen.poutsma Arjen Poutsma made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open In Progress In Progress
          61d 17h 15m 1 Arjen Poutsma 09/Nov/09 8:37 PM
          In Progress In Progress Resolved Resolved
          4h 9m 1 Arjen Poutsma 10/Nov/09 12:47 AM
          Resolved Resolved Closed Closed
          906d 6h 15m 1 Arjen Poutsma 04/May/12 7:03 AM

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              nblair Nicholas Blair
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 4h 5m
                4h 5m