[ 
https://issues.apache.org/jira/browse/DIRMINA-1185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17903833#comment-17903833
 ] 

Emmanuel Lécharny commented on DIRMINA-1185:
--------------------------------------------

hi,

 

are you setting the SO_REUSEADDR flag before binding?

Like:

{code:java}
{color:#000000} {color}{color:#000000}SocketAcceptor{color}{color:#000000} 
{color}{color:#6a3e3e}acceptor{color}{color:#000000} = 
{color}{color:#7f0055}new{color}{color:#000000} NioSocketAcceptor();{color}

{color:#000000} 
{color}{color:#6a3e3e}acceptor{color}{color:#000000}.{color}{color:#000000}setReuseAddress{color}{color:#000000}(
 {color}{color:#7f0055}true{color}{color:#000000} );{color}

{code}

> Question about Unbinding NioAcceptor
> ------------------------------------
>
>                 Key: DIRMINA-1185
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1185
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.8
>            Reporter: Alexander B
>            Priority: Major
>
> Hi there,
> We have an application (Tomcat7 , Java8), which uses Mina 2.1.8. The 
> intention is to open a port (in this example 2004) and close this connection 
> object in case nobody will be connected. Then after a moment a new binding 
> should be performed on this object.
> Until today this Tomcat ran on HTTP. I have switched to HTTPS and actually I 
> did not touch any code, which includes/extends any Mina-classes. 
> In the first case (Tomcat running on HTTP), there is an instance of 
> NioSocketAcceptor, which will be `unbind()`, if there is no connection after 
> a specific time. Then a reconnect (new bind on port 2004) will be performed 
> and the same port will be opened again. This works fine.
> In the second case (Tomcat running on HTTPS with the following changes: I 
> created a keystore, integrated it into the project and adapted tomcat's 
> server.xml) after a specific time I called unbind() on the 
> NioSocketAccepter-object and then a reconnect we will performed again. In 
> this moment, the new binding crashes with the message :
> ```
> java.io.IOException: Error while binding on 0.0.0.0/0.0.0.0:2004
>         at 
> org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:301)
>         at 
> org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:52)
>         at 
> org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.registerHandles(AbstractPollingIoAcceptor.java:621)
>         at 
> org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:518)
>         at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
>         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>         at java.lang.Thread.run(Thread.java:748)
> Caused by: java.net.BindException: Address already in use: bind
>         at sun.nio.ch.Net.bind0(Native Method)
>         at sun.nio.ch.Net.bind(Net.java:461)
>         at sun.nio.ch.Net.bind(Net.java:453)
>         at 
> sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
>         at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
>         at 
> org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:296)
>         ... 7 common frames omitted
> ```
> Do you know, if there are any issues regarding the unbinding process in Mina 
> in combination with a running Tomcat on HTTPS? Or do I have to change any 
> implementation including mina classes?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to