Hi,

I use Mina 2.0.7 in combination with Apache Camel. There seems to be a problem 
when on the machine on which the application runs, both IPv4 and IPv6 stacks 
are enabled.

I observed the following:

- A IPv4 based Mina address is configured, camel calls 
org.apache.mina.transport.socket.nio.NioSocketAcceptor.bind with the Inet4 
address
- internally, in combination with JDK classes (I tried several JDK versions, 
jdk6 and jdk7 based), the Inet4 address is translated to an Inet6 address and 
stored as boundAddress within 
org.apache.mina.transport.socket.nio.NioSocketAcceptor / 
org.apache.mina.core.service.AbstractIoAcceptor

- when camel shuts down, it calls unbind on the same 
org.apache.mina.transport.socket.nio.NioSocketAcceptor, once again with the 
original Inet4 address
- The NioSocketAcceptor (to be more precise, its base class AbstractIoAcceptor) 
checks whether it is bound to that address. Since, during the bind, there was 
the 'translation' to an Inet6 address, it decides that it is not bound to the 
supplied Inet4 address and therefore does not unbind
- Consequences are that Mina Threads are not finished and therefore the 
application does not cleanly shut down and hangs.

In my opinion the camel behavior is correct: It has an address and binds and 
unbinds using this address.
There is a workaround: Setting the system property 
-Djava.net.preferIPv4Stack=true , but, in my opinion, this is only a 
workaround. The Mina Acceptor classes should provide the appropriate logic to 
detect that it is bound to an appropriate Inet4 address even if it has been 
'translated' to an Inet6 address during bind.

Kind Regards,
Stefan Albrecht
   
InterComponentWare AG:  
Vorstand: Peter Kirschbauer (Vors.), Matthias Glück  
Aufsichtsratsvors.: Prof. Dr. Christof Hettich  
Firmensitz: 69190 Walldorf, Altrottstraße 31  
AG Mannheim HRB 351761 / USt.-IdNr.: DE 198388516  

Reply via email to