cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Tully (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-1217) Address in use errors from attempt to repeatedly start and stop services
Date Wed, 21 Nov 2007 14:56:43 GMT

    [ https://issues.apache.org/jira/browse/CXF-1217?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12544486
] 

Gary Tully commented on CXF-1217:
---------------------------------

Re Jetty and SO_REUSEADDR, I just traced through the code and I think the problem may be that
the SO_REUSEADDR option is set after the bind call, so it is only in effect for the next call
on that channel/socket which will never ocurr in my test case. We get another Connector as
we should.

There is no space between the open and bind call into which we can inject the SO_REUSEADDR
property in org.mortbay.jetty.nio.SelectChannelConnector: 

    public void open() throws IOException
    {
        synchronized(this)
        {
            if (_acceptChannel == null)
            {
                // Create a new server socket
                _acceptChannel = ServerSocketChannel.open();

                // Bind the server socket to the local host and port
                InetSocketAddress addr = getHost()==null?new InetSocketAddress(getPort()):new
InetSocketAddress(getHost(),getPort());
                _acceptChannel.socket().bind(addr,getAcceptQueueSize());

                // Set to non blocking mode
                _acceptChannel.configureBlocking(false);
            }
        }
    }

Also, _acceptChannel is private so it is not easy to override this behaviour. Using a ServerSocketChanell
provider is not really an option as it is difficult to tie this to the soReuseAddr option
in the the CXF org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.

I am thinking that there should be a call to configureBind() or something, between the open
and the bind calls.


> Address in use errors from attempt to repeatedly start and stop services
> ------------------------------------------------------------------------
>
>                 Key: CXF-1217
>                 URL: https://issues.apache.org/jira/browse/CXF-1217
>             Project: CXF
>          Issue Type: Bug
>          Components: Transports
>    Affects Versions: 2.1
>         Environment: Any
>            Reporter: Benson Margulies
>         Attachments: busShutdownTest.patch.txt
>
>
> Edit org.apache.cxf.javascript.JsHttpRequestTest to take out the @org.junit.Ignore from
the test case that has one, and run from eclipse. Watch the logging traffic. Observe:
> WARNING: failed Server@1174031
> java.net.BindException: Address already in use: bind
>         at sun.nio.ch.Net.bind(Native Method)
> which eventually, as far as I can tell, turns into:
> INFO: doOpen POST http://localhost:8808/Greeter false
> Nov 18, 2007 10:07:08 PM org.apache.cxf.javascript.JsXMLHttpRequest communicate
> SEVERE: IO error reading response
> java.io.FileNotFoundException: http://localhost:8808/Greeter
> On the other hand, all is well in Eclipse. 
> I will probably commit a workaround to this soon, so it would be good to move this muddle
to its own test case.

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


Mime
View raw message