You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "willem Jiang (JIRA)" <ji...@apache.org> on 2007/07/31 09:41:53 UTC

[jira] Created: (CXF-865) CXF http-jetty transport do not call the jetty server engine shutdown when the server stop

CXF http-jetty transport do not call the jetty server engine shutdown when the server stop
------------------------------------------------------------------------------------------

                 Key: CXF-865
                 URL: https://issues.apache.org/jira/browse/CXF-865
             Project: CXF
          Issue Type: Bug
          Components: Transports
    Affects Versions: 2.0
            Reporter: willem Jiang


It appears that stopping the server in CXF is not shutting down the Jetty engine, which causes my application to hang because Jetty's threads are still blocking on the server socket accept. After a shutdown, I still see Thread [btpool0-0 - Acceptor0 SelectChannelConnector@0.0.0.0:10001] (Running).

I have a simple test application pasted below that can reproduce the problem. At this point I had to add some calls to get the destination and cast it to a Jetty specific class to get things to exit. Is there a better way to do this? Is there something I'm not configuring correctly? Any help is appreciated.
 
This is under Java 1.5 with CXF 2.0. Jetty is being included from the CXF libs directory. 
 
package org.mpilone.cxftest;
 
import java.io.IOException;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.frontend.ServerFactoryBean;
 
public class CxfJettyTest
{
  public void doIt()
  {
    System.out.println("Running test method");
  }
 
  public static void main(String[] args) throws IOException
  {
    // Create an Service and Server
    ServerFactoryBean serverFactory = new ServerFactoryBean();
    serverFactory.setServiceClass(CxfJettyTest.class);
    serverFactory.setServiceBean(new CxfJettyTest());
    serverFactory.setAddress("http://localhost:10001/RemoteApi");
    Server mServer = serverFactory.create();
 
    mServer.start();
    System.in.read();
    mServer.stop();
 
    // Adding these lines allows the application to exit, but
    // WARNING: EXCEPTION
    // java.nio.channels.ClosedChannelException
    // log statements are produced.
 
// JettyHTTPDestination jettyDest = (JettyHTTPDestination)
// mServer.getDestination();
// JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine)
// jettyDest.getEngine();
// jettyEngine.shutdown();
 
    System.out.println("Exiting");
  }
}


If you looking into the code you will find there is a note in the JettyHTTPServerEngine's removeServant(URL url)

            /* Bug in Jetty, we cannot do this.  If we restart later, data goes off
             * someplace unknown
            if (servantCount == 0) {
                try {
                   ....
            }*/

I just added the shutdown engine's code below the comments and tested it against the systest. There were some  tests (such as ws.rm , mtom )failed.
It looks like if we shutdown the engine, when the engine start again , the engine can not get the request info again , specially the http keep alive message.
Current I can't reproduce this bug by adding the unit test which simply calls start and shutdown method the JettyHTTPServerEngine.
It may take some time to resolve this issue. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-865) CXF http-jetty transport do not call the jetty server engine shutdown when the server stop

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

willem Jiang resolved CXF-865.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1
                   2.0.4

The fix should be in the svn repository now.

> CXF http-jetty transport do not call the jetty server engine shutdown when the server stop
> ------------------------------------------------------------------------------------------
>
>                 Key: CXF-865
>                 URL: https://issues.apache.org/jira/browse/CXF-865
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.0
>            Reporter: willem Jiang
>            Assignee: willem Jiang
>             Fix For: 2.0.4, 2.1
>
>
> It appears that stopping the server in CXF is not shutting down the Jetty engine, which causes my application to hang because Jetty's threads are still blocking on the server socket accept. After a shutdown, I still see Thread [btpool0-0 - Acceptor0 SelectChannelConnector@0.0.0.0:10001] (Running).
> I have a simple test application pasted below that can reproduce the problem. At this point I had to add some calls to get the destination and cast it to a Jetty specific class to get things to exit. Is there a better way to do this? Is there something I'm not configuring correctly? Any help is appreciated.
>  
> This is under Java 1.5 with CXF 2.0. Jetty is being included from the CXF libs directory. 
>  
> package org.mpilone.cxftest;
>  
> import java.io.IOException;
> import org.apache.cxf.endpoint.Server;
> import org.apache.cxf.frontend.ServerFactoryBean;
>  
> public class CxfJettyTest
> {
>   public void doIt()
>   {
>     System.out.println("Running test method");
>   }
>  
>   public static void main(String[] args) throws IOException
>   {
>     // Create an Service and Server
>     ServerFactoryBean serverFactory = new ServerFactoryBean();
>     serverFactory.setServiceClass(CxfJettyTest.class);
>     serverFactory.setServiceBean(new CxfJettyTest());
>     serverFactory.setAddress("http://localhost:10001/RemoteApi");
>     Server mServer = serverFactory.create();
>  
>     mServer.start();
>     System.in.read();
>     mServer.stop();
>  
>     // Adding these lines allows the application to exit, but
>     // WARNING: EXCEPTION
>     // java.nio.channels.ClosedChannelException
>     // log statements are produced.
>  
> // JettyHTTPDestination jettyDest = (JettyHTTPDestination)
> // mServer.getDestination();
> // JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine)
> // jettyDest.getEngine();
> // jettyEngine.shutdown();
>  
>     System.out.println("Exiting");
>   }
> }
> If you looking into the code you will find there is a note in the JettyHTTPServerEngine's removeServant(URL url)
>             /* Bug in Jetty, we cannot do this.  If we restart later, data goes off
>              * someplace unknown
>             if (servantCount == 0) {
>                 try {
>                    ....
>             }*/
> I just added the shutdown engine's code below the comments and tested it against the systest. There were some  tests (such as ws.rm , mtom )failed.
> It looks like if we shutdown the engine, when the engine start again , the engine can not get the request info again , specially the http keep alive message.
> Current I can't reproduce this bug by adding the unit test which simply calls start and shutdown method the JettyHTTPServerEngine.
> It may take some time to resolve this issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-865) CXF http-jetty transport do not call the jetty server engine shutdown when the server stop

Posted by "Jonathan Gathman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540798 ] 

Jonathan Gathman commented on CXF-865:
--------------------------------------

I ran through a few scenarios, and several things come to light for me.

JettyHTTPServerEngine.stop() FIRST calls "connector.close()".

It is this closing connector which is causing the exception to be thrown, not Jetty's Server.stop().

Second, it's clear that it's a thread timing issue, because when I run in Debug mode, it sometimes ends without error (depending on when I have a breakpoint)

Finally, I'm able to alleviate the Exception Symptoms by first calling "connector.stop()", which is a method on Jetty's "Lifecycle Interface".

According to Jetty's JavaDoc,

void stop()
          throws Exception

    Stops the component. The component may wait for current activities to complete normally, but it can be interrupted.

It appears to me, therefore, that calling "stop()" before close() in the "JettyHttpServerEngine.stop()" method will coordinate the thread ends better, quelling the exception.


I don't have a use case for restarting Jetty Server, but, in JettyHttpServerEngine.stop() , it calls "server.destroy()" after "server.stop()".  My guess would be that the server would subsequently be unusable because of this call.

Hope this helps.


> CXF http-jetty transport do not call the jetty server engine shutdown when the server stop
> ------------------------------------------------------------------------------------------
>
>                 Key: CXF-865
>                 URL: https://issues.apache.org/jira/browse/CXF-865
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.0
>            Reporter: willem Jiang
>
> It appears that stopping the server in CXF is not shutting down the Jetty engine, which causes my application to hang because Jetty's threads are still blocking on the server socket accept. After a shutdown, I still see Thread [btpool0-0 - Acceptor0 SelectChannelConnector@0.0.0.0:10001] (Running).
> I have a simple test application pasted below that can reproduce the problem. At this point I had to add some calls to get the destination and cast it to a Jetty specific class to get things to exit. Is there a better way to do this? Is there something I'm not configuring correctly? Any help is appreciated.
>  
> This is under Java 1.5 with CXF 2.0. Jetty is being included from the CXF libs directory. 
>  
> package org.mpilone.cxftest;
>  
> import java.io.IOException;
> import org.apache.cxf.endpoint.Server;
> import org.apache.cxf.frontend.ServerFactoryBean;
>  
> public class CxfJettyTest
> {
>   public void doIt()
>   {
>     System.out.println("Running test method");
>   }
>  
>   public static void main(String[] args) throws IOException
>   {
>     // Create an Service and Server
>     ServerFactoryBean serverFactory = new ServerFactoryBean();
>     serverFactory.setServiceClass(CxfJettyTest.class);
>     serverFactory.setServiceBean(new CxfJettyTest());
>     serverFactory.setAddress("http://localhost:10001/RemoteApi");
>     Server mServer = serverFactory.create();
>  
>     mServer.start();
>     System.in.read();
>     mServer.stop();
>  
>     // Adding these lines allows the application to exit, but
>     // WARNING: EXCEPTION
>     // java.nio.channels.ClosedChannelException
>     // log statements are produced.
>  
> // JettyHTTPDestination jettyDest = (JettyHTTPDestination)
> // mServer.getDestination();
> // JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine)
> // jettyDest.getEngine();
> // jettyEngine.shutdown();
>  
>     System.out.println("Exiting");
>   }
> }
> If you looking into the code you will find there is a note in the JettyHTTPServerEngine's removeServant(URL url)
>             /* Bug in Jetty, we cannot do this.  If we restart later, data goes off
>              * someplace unknown
>             if (servantCount == 0) {
>                 try {
>                    ....
>             }*/
> I just added the shutdown engine's code below the comments and tested it against the systest. There were some  tests (such as ws.rm , mtom )failed.
> It looks like if we shutdown the engine, when the engine start again , the engine can not get the request info again , specially the http keep alive message.
> Current I can't reproduce this bug by adding the unit test which simply calls start and shutdown method the JettyHTTPServerEngine.
> It may take some time to resolve this issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (CXF-865) CXF http-jetty transport do not call the jetty server engine shutdown when the server stop

Posted by "Jonathan Gathman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540804 ] 

jgathman edited comment on CXF-865 at 11/7/07 9:04 AM:
---------------------------------------------------------------

I forgot to mention... JettyHTTPDestination doesn't call "shutdown" on it's JettyHTTPServerEngine server object within it's own shutdown method, which should be start the shutdown of Jetty in the first place.



      was (Author: jgathman):
    I forgot to mention... JettyHTTPDestination doesn't call "shutdown" on it's JettyHTTPServerEngine server object, which should start the shutdown process rolling.
  
> CXF http-jetty transport do not call the jetty server engine shutdown when the server stop
> ------------------------------------------------------------------------------------------
>
>                 Key: CXF-865
>                 URL: https://issues.apache.org/jira/browse/CXF-865
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.0
>            Reporter: willem Jiang
>
> It appears that stopping the server in CXF is not shutting down the Jetty engine, which causes my application to hang because Jetty's threads are still blocking on the server socket accept. After a shutdown, I still see Thread [btpool0-0 - Acceptor0 SelectChannelConnector@0.0.0.0:10001] (Running).
> I have a simple test application pasted below that can reproduce the problem. At this point I had to add some calls to get the destination and cast it to a Jetty specific class to get things to exit. Is there a better way to do this? Is there something I'm not configuring correctly? Any help is appreciated.
>  
> This is under Java 1.5 with CXF 2.0. Jetty is being included from the CXF libs directory. 
>  
> package org.mpilone.cxftest;
>  
> import java.io.IOException;
> import org.apache.cxf.endpoint.Server;
> import org.apache.cxf.frontend.ServerFactoryBean;
>  
> public class CxfJettyTest
> {
>   public void doIt()
>   {
>     System.out.println("Running test method");
>   }
>  
>   public static void main(String[] args) throws IOException
>   {
>     // Create an Service and Server
>     ServerFactoryBean serverFactory = new ServerFactoryBean();
>     serverFactory.setServiceClass(CxfJettyTest.class);
>     serverFactory.setServiceBean(new CxfJettyTest());
>     serverFactory.setAddress("http://localhost:10001/RemoteApi");
>     Server mServer = serverFactory.create();
>  
>     mServer.start();
>     System.in.read();
>     mServer.stop();
>  
>     // Adding these lines allows the application to exit, but
>     // WARNING: EXCEPTION
>     // java.nio.channels.ClosedChannelException
>     // log statements are produced.
>  
> // JettyHTTPDestination jettyDest = (JettyHTTPDestination)
> // mServer.getDestination();
> // JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine)
> // jettyDest.getEngine();
> // jettyEngine.shutdown();
>  
>     System.out.println("Exiting");
>   }
> }
> If you looking into the code you will find there is a note in the JettyHTTPServerEngine's removeServant(URL url)
>             /* Bug in Jetty, we cannot do this.  If we restart later, data goes off
>              * someplace unknown
>             if (servantCount == 0) {
>                 try {
>                    ....
>             }*/
> I just added the shutdown engine's code below the comments and tested it against the systest. There were some  tests (such as ws.rm , mtom )failed.
> It looks like if we shutdown the engine, when the engine start again , the engine can not get the request info again , specially the http keep alive message.
> Current I can't reproduce this bug by adding the unit test which simply calls start and shutdown method the JettyHTTPServerEngine.
> It may take some time to resolve this issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-865) CXF http-jetty transport do not call the jetty server engine shutdown when the server stop

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540805 ] 

Sergey Beryozkin commented on CXF-865:
--------------------------------------

I can confirm with cxf 2.0.3 I'm seeing a CloseChannelException thrown on shutdown

> CXF http-jetty transport do not call the jetty server engine shutdown when the server stop
> ------------------------------------------------------------------------------------------
>
>                 Key: CXF-865
>                 URL: https://issues.apache.org/jira/browse/CXF-865
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.0
>            Reporter: willem Jiang
>
> It appears that stopping the server in CXF is not shutting down the Jetty engine, which causes my application to hang because Jetty's threads are still blocking on the server socket accept. After a shutdown, I still see Thread [btpool0-0 - Acceptor0 SelectChannelConnector@0.0.0.0:10001] (Running).
> I have a simple test application pasted below that can reproduce the problem. At this point I had to add some calls to get the destination and cast it to a Jetty specific class to get things to exit. Is there a better way to do this? Is there something I'm not configuring correctly? Any help is appreciated.
>  
> This is under Java 1.5 with CXF 2.0. Jetty is being included from the CXF libs directory. 
>  
> package org.mpilone.cxftest;
>  
> import java.io.IOException;
> import org.apache.cxf.endpoint.Server;
> import org.apache.cxf.frontend.ServerFactoryBean;
>  
> public class CxfJettyTest
> {
>   public void doIt()
>   {
>     System.out.println("Running test method");
>   }
>  
>   public static void main(String[] args) throws IOException
>   {
>     // Create an Service and Server
>     ServerFactoryBean serverFactory = new ServerFactoryBean();
>     serverFactory.setServiceClass(CxfJettyTest.class);
>     serverFactory.setServiceBean(new CxfJettyTest());
>     serverFactory.setAddress("http://localhost:10001/RemoteApi");
>     Server mServer = serverFactory.create();
>  
>     mServer.start();
>     System.in.read();
>     mServer.stop();
>  
>     // Adding these lines allows the application to exit, but
>     // WARNING: EXCEPTION
>     // java.nio.channels.ClosedChannelException
>     // log statements are produced.
>  
> // JettyHTTPDestination jettyDest = (JettyHTTPDestination)
> // mServer.getDestination();
> // JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine)
> // jettyDest.getEngine();
> // jettyEngine.shutdown();
>  
>     System.out.println("Exiting");
>   }
> }
> If you looking into the code you will find there is a note in the JettyHTTPServerEngine's removeServant(URL url)
>             /* Bug in Jetty, we cannot do this.  If we restart later, data goes off
>              * someplace unknown
>             if (servantCount == 0) {
>                 try {
>                    ....
>             }*/
> I just added the shutdown engine's code below the comments and tested it against the systest. There were some  tests (such as ws.rm , mtom )failed.
> It looks like if we shutdown the engine, when the engine start again , the engine can not get the request info again , specially the http keep alive message.
> Current I can't reproduce this bug by adding the unit test which simply calls start and shutdown method the JettyHTTPServerEngine.
> It may take some time to resolve this issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-865) CXF http-jetty transport do not call the jetty server engine shutdown when the server stop

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540812 ] 

willem Jiang commented on CXF-865:
----------------------------------

I just want to do a quick fixing for it with the below code:

     if (server != null) {
            try {
                connector.stop();
                connector.close();            
            } finally {         
                server.stop();
                server.destroy();
                server = null;
            }
        }



BTW, now we just shutdown the JettyEngine when the Bus.shutdown() is called. 
For calling the Server.start() and stop() , the JettyEngine will not be effected.

Willem.

> CXF http-jetty transport do not call the jetty server engine shutdown when the server stop
> ------------------------------------------------------------------------------------------
>
>                 Key: CXF-865
>                 URL: https://issues.apache.org/jira/browse/CXF-865
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.0
>            Reporter: willem Jiang
>            Assignee: willem Jiang
>
> It appears that stopping the server in CXF is not shutting down the Jetty engine, which causes my application to hang because Jetty's threads are still blocking on the server socket accept. After a shutdown, I still see Thread [btpool0-0 - Acceptor0 SelectChannelConnector@0.0.0.0:10001] (Running).
> I have a simple test application pasted below that can reproduce the problem. At this point I had to add some calls to get the destination and cast it to a Jetty specific class to get things to exit. Is there a better way to do this? Is there something I'm not configuring correctly? Any help is appreciated.
>  
> This is under Java 1.5 with CXF 2.0. Jetty is being included from the CXF libs directory. 
>  
> package org.mpilone.cxftest;
>  
> import java.io.IOException;
> import org.apache.cxf.endpoint.Server;
> import org.apache.cxf.frontend.ServerFactoryBean;
>  
> public class CxfJettyTest
> {
>   public void doIt()
>   {
>     System.out.println("Running test method");
>   }
>  
>   public static void main(String[] args) throws IOException
>   {
>     // Create an Service and Server
>     ServerFactoryBean serverFactory = new ServerFactoryBean();
>     serverFactory.setServiceClass(CxfJettyTest.class);
>     serverFactory.setServiceBean(new CxfJettyTest());
>     serverFactory.setAddress("http://localhost:10001/RemoteApi");
>     Server mServer = serverFactory.create();
>  
>     mServer.start();
>     System.in.read();
>     mServer.stop();
>  
>     // Adding these lines allows the application to exit, but
>     // WARNING: EXCEPTION
>     // java.nio.channels.ClosedChannelException
>     // log statements are produced.
>  
> // JettyHTTPDestination jettyDest = (JettyHTTPDestination)
> // mServer.getDestination();
> // JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine)
> // jettyDest.getEngine();
> // jettyEngine.shutdown();
>  
>     System.out.println("Exiting");
>   }
> }
> If you looking into the code you will find there is a note in the JettyHTTPServerEngine's removeServant(URL url)
>             /* Bug in Jetty, we cannot do this.  If we restart later, data goes off
>              * someplace unknown
>             if (servantCount == 0) {
>                 try {
>                    ....
>             }*/
> I just added the shutdown engine's code below the comments and tested it against the systest. There were some  tests (such as ws.rm , mtom )failed.
> It looks like if we shutdown the engine, when the engine start again , the engine can not get the request info again , specially the http keep alive message.
> Current I can't reproduce this bug by adding the unit test which simply calls start and shutdown method the JettyHTTPServerEngine.
> It may take some time to resolve this issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-865) CXF http-jetty transport do not call the jetty server engine shutdown when the server stop

Posted by "Jonathan Gathman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540804 ] 

Jonathan Gathman commented on CXF-865:
--------------------------------------

I forgot to mention... JettyHTTPDestination doesn't call "shutdown" on it's JettyHTTPServerEngine server object, which should start the shutdown process rolling.

> CXF http-jetty transport do not call the jetty server engine shutdown when the server stop
> ------------------------------------------------------------------------------------------
>
>                 Key: CXF-865
>                 URL: https://issues.apache.org/jira/browse/CXF-865
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.0
>            Reporter: willem Jiang
>
> It appears that stopping the server in CXF is not shutting down the Jetty engine, which causes my application to hang because Jetty's threads are still blocking on the server socket accept. After a shutdown, I still see Thread [btpool0-0 - Acceptor0 SelectChannelConnector@0.0.0.0:10001] (Running).
> I have a simple test application pasted below that can reproduce the problem. At this point I had to add some calls to get the destination and cast it to a Jetty specific class to get things to exit. Is there a better way to do this? Is there something I'm not configuring correctly? Any help is appreciated.
>  
> This is under Java 1.5 with CXF 2.0. Jetty is being included from the CXF libs directory. 
>  
> package org.mpilone.cxftest;
>  
> import java.io.IOException;
> import org.apache.cxf.endpoint.Server;
> import org.apache.cxf.frontend.ServerFactoryBean;
>  
> public class CxfJettyTest
> {
>   public void doIt()
>   {
>     System.out.println("Running test method");
>   }
>  
>   public static void main(String[] args) throws IOException
>   {
>     // Create an Service and Server
>     ServerFactoryBean serverFactory = new ServerFactoryBean();
>     serverFactory.setServiceClass(CxfJettyTest.class);
>     serverFactory.setServiceBean(new CxfJettyTest());
>     serverFactory.setAddress("http://localhost:10001/RemoteApi");
>     Server mServer = serverFactory.create();
>  
>     mServer.start();
>     System.in.read();
>     mServer.stop();
>  
>     // Adding these lines allows the application to exit, but
>     // WARNING: EXCEPTION
>     // java.nio.channels.ClosedChannelException
>     // log statements are produced.
>  
> // JettyHTTPDestination jettyDest = (JettyHTTPDestination)
> // mServer.getDestination();
> // JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine)
> // jettyDest.getEngine();
> // jettyEngine.shutdown();
>  
>     System.out.println("Exiting");
>   }
> }
> If you looking into the code you will find there is a note in the JettyHTTPServerEngine's removeServant(URL url)
>             /* Bug in Jetty, we cannot do this.  If we restart later, data goes off
>              * someplace unknown
>             if (servantCount == 0) {
>                 try {
>                    ....
>             }*/
> I just added the shutdown engine's code below the comments and tested it against the systest. There were some  tests (such as ws.rm , mtom )failed.
> It looks like if we shutdown the engine, when the engine start again , the engine can not get the request info again , specially the http keep alive message.
> Current I can't reproduce this bug by adding the unit test which simply calls start and shutdown method the JettyHTTPServerEngine.
> It may take some time to resolve this issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CXF-865) CXF http-jetty transport do not call the jetty server engine shutdown when the server stop

Posted by "willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

willem Jiang reassigned CXF-865:
--------------------------------

    Assignee: willem Jiang

> CXF http-jetty transport do not call the jetty server engine shutdown when the server stop
> ------------------------------------------------------------------------------------------
>
>                 Key: CXF-865
>                 URL: https://issues.apache.org/jira/browse/CXF-865
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.0
>            Reporter: willem Jiang
>            Assignee: willem Jiang
>
> It appears that stopping the server in CXF is not shutting down the Jetty engine, which causes my application to hang because Jetty's threads are still blocking on the server socket accept. After a shutdown, I still see Thread [btpool0-0 - Acceptor0 SelectChannelConnector@0.0.0.0:10001] (Running).
> I have a simple test application pasted below that can reproduce the problem. At this point I had to add some calls to get the destination and cast it to a Jetty specific class to get things to exit. Is there a better way to do this? Is there something I'm not configuring correctly? Any help is appreciated.
>  
> This is under Java 1.5 with CXF 2.0. Jetty is being included from the CXF libs directory. 
>  
> package org.mpilone.cxftest;
>  
> import java.io.IOException;
> import org.apache.cxf.endpoint.Server;
> import org.apache.cxf.frontend.ServerFactoryBean;
>  
> public class CxfJettyTest
> {
>   public void doIt()
>   {
>     System.out.println("Running test method");
>   }
>  
>   public static void main(String[] args) throws IOException
>   {
>     // Create an Service and Server
>     ServerFactoryBean serverFactory = new ServerFactoryBean();
>     serverFactory.setServiceClass(CxfJettyTest.class);
>     serverFactory.setServiceBean(new CxfJettyTest());
>     serverFactory.setAddress("http://localhost:10001/RemoteApi");
>     Server mServer = serverFactory.create();
>  
>     mServer.start();
>     System.in.read();
>     mServer.stop();
>  
>     // Adding these lines allows the application to exit, but
>     // WARNING: EXCEPTION
>     // java.nio.channels.ClosedChannelException
>     // log statements are produced.
>  
> // JettyHTTPDestination jettyDest = (JettyHTTPDestination)
> // mServer.getDestination();
> // JettyHTTPServerEngine jettyEngine = (JettyHTTPServerEngine)
> // jettyDest.getEngine();
> // jettyEngine.shutdown();
>  
>     System.out.println("Exiting");
>   }
> }
> If you looking into the code you will find there is a note in the JettyHTTPServerEngine's removeServant(URL url)
>             /* Bug in Jetty, we cannot do this.  If we restart later, data goes off
>              * someplace unknown
>             if (servantCount == 0) {
>                 try {
>                    ....
>             }*/
> I just added the shutdown engine's code below the comments and tested it against the systest. There were some  tests (such as ws.rm , mtom )failed.
> It looks like if we shutdown the engine, when the engine start again , the engine can not get the request info again , specially the http keep alive message.
> Current I can't reproduce this bug by adding the unit test which simply calls start and shutdown method the JettyHTTPServerEngine.
> It may take some time to resolve this issue. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.