[ 
https://issues.apache.org/jira/browse/CASSANDRA-18583?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stefan Miklosovic updated CASSANDRA-18583:
------------------------------------------
    Description: 
{code:java}
public class MyTest extends TestBaseImpl
{
    @Test
    public void test() throws Throwable
    {
        try (Cluster cluster = Cluster.build(2).withConfig(c -> 
c.with(Feature.values())).start())
        {
            ClusterUtils.stopUnchecked(cluster.get(2));
            
System.out.println(cluster.get(1).nodetoolResult("status").getStderr());
        }
    }
}  {code}
This will fail on this:
{code:java}
java.net.BindException: Address already in use (Bind failed)
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at 
java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
        at java.net.ServerSocket.bind(ServerSocket.java:390)
        at java.net.ServerSocket.<init>(ServerSocket.java:252)
        at 
javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
        at org.apache.cassandra.distributed.impl.CollectingRMIServerSocketFac
{code}

The problem is that IsolatedJMX clears whole map of TCPTransports in 
clearMapField as part of the stopJmx method. This results in JMX internals 
thinking the socket is not there so it tries to create it but it fails to do so 
because it is technically still bound.

The fix is consisting of cleaning just the bits belonging to that specific 
IsolatedJMX instance.

All creds to fixing the issue goes to 

The investigation of the issue done by myself, the actual fix by [~drohrer]. 
Found while working on CASSANDRA-18572.

> Fix shutting down IsolatedJmx 
> ------------------------------
>
>                 Key: CASSANDRA-18583
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-18583
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Test/dtest/java
>            Reporter: Stefan Miklosovic
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 3.11.x, 4.0.x, 4.1.x, 5.x
>
>
> {code:java}
> public class MyTest extends TestBaseImpl
> {
>     @Test
>     public void test() throws Throwable
>     {
>         try (Cluster cluster = Cluster.build(2).withConfig(c -> 
> c.with(Feature.values())).start())
>         {
>             ClusterUtils.stopUnchecked(cluster.get(2));
>             
> System.out.println(cluster.get(1).nodetoolResult("status").getStderr());
>         }
>     }
> }  {code}
> This will fail on this:
> {code:java}
> java.net.BindException: Address already in use (Bind failed)
>       at java.net.PlainSocketImpl.socketBind(Native Method)
>       at 
> java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
>       at java.net.ServerSocket.bind(ServerSocket.java:390)
>       at java.net.ServerSocket.<init>(ServerSocket.java:252)
>       at 
> javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
>       at org.apache.cassandra.distributed.impl.CollectingRMIServerSocketFac
> {code}
> The problem is that IsolatedJMX clears whole map of TCPTransports in 
> clearMapField as part of the stopJmx method. This results in JMX internals 
> thinking the socket is not there so it tries to create it but it fails to do 
> so because it is technically still bound.
> The fix is consisting of cleaning just the bits belonging to that specific 
> IsolatedJMX instance.
> All creds to fixing the issue goes to 
> The investigation of the issue done by myself, the actual fix by [~drohrer]. 
> Found while working on CASSANDRA-18572.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to