You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2008/11/18 00:29:44 UTC

[jira] Created: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

DefaultSocketSessionConfig creates some connection to itself.
-------------------------------------------------------------

                 Key: DIRMINA-638
                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
             Project: MINA
          Issue Type: Bug
    Affects Versions: 2.0.0-M3
            Reporter: Emmanuel Lecharny
            Priority: Blocker
             Fix For: 2.0.0-M4


For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :

    static {
        initializeTestAddresses();

        boolean success = false;
        for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
            success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
            if (success) {
                break;
            }
        }

    private static void initializeTestAddresses() {
        try {
            TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
            TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
        } catch (UnknownHostException e) {
            ExceptionMonitor.getInstance().exceptionCaught(e);
        }
    }


    private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
        ServerSocket ss = null;
        Socket socket = null;

        try {
            ss = new ServerSocket();
            ss.bind(bindAddress);
            socket = new Socket();

            socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);

            initializeDefaultSocketParameters(socket);
            return true;
        } catch (IOException ioe) {
            return false;
        } finally {
            if (socket != null) {
                try {
                    socket.close();
                } catch (IOException e) {
                    ExceptionMonitor.getInstance().exceptionCaught(e);
                }
            }

            if (ss != null) {
                try {
                    ss.close();
                } catch (IOException e) {
                    ExceptionMonitor.getInstance().exceptionCaught(e);
                }
            }
       }
    }

The _only_ reason why this code exists is to setup the default values for the socket configuration. 

Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).

It as to be fixed urgently.

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


[jira] Commented: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

Posted by "Matthew McMahon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663241#action_12663241 ] 

Matthew McMahon commented on DIRMINA-638:
-----------------------------------------

I am new to Mina and the whole environment. Anyway, I am creating a project that began with 2.0.0-M3 and is now using 2.0.0-M4. I have this issue, where my server and client is creating a lot of loopback threads, that I believe must be related to this issue. Any word on whether it will be fixed?

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7
>            Reporter: Emmanuel Lecharny
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 1.1.8
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Commented: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648419#action_12648419 ] 

Emmanuel Lecharny commented on DIRMINA-638:
-------------------------------------------

Yeah, I just created a lonk on it.

It may be reliable, but the problem is that when used in an Applet, it will simply not work. We are 'happy' that Alexander not only have had the problem, but was clever enough to dig it and found what was the problem ! I was totally unaware that this class was doing such a socket connection...

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7, 2.0.0-M3
>            Reporter: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 2.0.0-M4, 1.1.8
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Updated: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

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

Emmanuel Lecharny updated DIRMINA-638:
--------------------------------------

    Affects Version/s:     (was: 2.0.0-M3)
        Fix Version/s:     (was: 2.0.0-M4)

Just kept 1.1.7 as the problem is fixed for 2.0.0-M3 (hopefully)

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7
>            Reporter: Emmanuel Lecharny
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 1.1.8
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Assigned: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

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

Emmanuel Lecharny reassigned DIRMINA-638:
-----------------------------------------

    Assignee: Emmanuel Lecharny

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7, 2.0.0-M3
>            Reporter: Emmanuel Lecharny
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 2.0.0-M4, 1.1.8
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Commented: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

Posted by "John Costello (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12667699#action_12667699 ] 

John Costello commented on DIRMINA-638:
---------------------------------------

Removing the socket testing code from the DefaultSocketSessionConfig has had an unintended side effect for stand alone applications that use the NioSocketAcceptor. Before binding to the port,  the receive buffer size on the ServerSocket is always set to value from the DefaultSocketSessionConfig, which previously would have been the OS default, but is now 1024 bytes. Upgrading from 2.0.0-M2 to 2.0.0-M4 caused a huge drop in read performance in several applications which previously had no trouble keeping up with the rate of incoming messages.  I was able to observe the receive buffer size on the server app staying pegged at close to 1400 bytes, and confirmed using a debugger that the socket recieve buffer size was being set to 1024 bytes, which is a rather small default.  

As a fix, I propose changing NioSocketAcceptor.open to check DefaultSocketSessionConfig.isReceiveBufferChanged before setting the receive buffer size on the ServerSocket. This will let the OS default be used in most cases which I think should be the expected behavior. I've attached a tar file containing patches with the proposed changes for NioSocketAcceptor, DefaultSocketSessionConfig and AbstractSocketSessionConfig

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7
>            Reporter: Emmanuel Lecharny
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 1.1.8
>
>         Attachments: mina-proposed-changes.tar
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Commented: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648623#action_12648623 ] 

Emmanuel Lecharny commented on DIRMINA-638:
-------------------------------------------

It should be fixed in 2.0.0-M3-SNAPSHOT

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7, 2.0.0-M3
>            Reporter: Emmanuel Lecharny
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 2.0.0-M4, 1.1.8
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Commented: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12663248#action_12663248 ] 

Emmanuel Lecharny commented on DIRMINA-638:
-------------------------------------------

This has been fixed in 2.0.0-M4

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7
>            Reporter: Emmanuel Lecharny
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 1.1.8
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Updated: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

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

John Costello updated DIRMINA-638:
----------------------------------

    Attachment: mina-proposed-changes.tar

Proposed changes to prevent NioSocketAcceptor from setting the socket receive buffer to 1024 bytes by default

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7
>            Reporter: Emmanuel Lecharny
>            Assignee: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 1.1.8
>
>         Attachments: mina-proposed-changes.tar
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Updated: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

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

Emmanuel Lecharny updated DIRMINA-638:
--------------------------------------

    Affects Version/s: 1.1.7
        Fix Version/s: 1.1.8

It affects also 1.1.7, and the Datagram support.

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7, 2.0.0-M3
>            Reporter: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 2.0.0-M4, 1.1.8
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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


[jira] Commented: (DIRMINA-638) DefaultSocketSessionConfig creates some connection to itself.

Posted by "Edouard De Oliveira (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRMINA-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648414#action_12648414 ] 

Edouard De Oliveira commented on DIRMINA-638:
---------------------------------------------

I would bet that this issue is related with https://issues.apache.org/jira/browse/DIRMINA-628 (quote = " Windows Firewall dialog complaining about our software trying to perform an operation that needs to be blocked / unblocked before continuing").

I remind an old thread discussion saying that it was the reliable way to test if some socket opts where available but it is ?

> DefaultSocketSessionConfig creates some connection to itself.
> -------------------------------------------------------------
>
>                 Key: DIRMINA-638
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-638
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 1.1.7, 2.0.0-M3
>            Reporter: Emmanuel Lecharny
>            Priority: Blocker
>             Fix For: 2.0.0-M4, 1.1.8
>
>
> For some unknown reason, the DefaultSocketSessionConfig class is creating a ServerSocket, and create a connection  :
>     static {
>         initializeTestAddresses();
>         boolean success = false;
>         for (Entry<InetSocketAddress, InetAddress> e : TEST_ADDRESSES.entrySet()) {
>             success = initializeDefaultSocketParameters(e.getKey(), e.getValue());
>             if (success) {
>                 break;
>             }
>         }
>     private static void initializeTestAddresses() {
>         try {
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 1 }));
>             TEST_ADDRESSES.put(new InetSocketAddress(0), InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }));
>         } catch (UnknownHostException e) {
>             ExceptionMonitor.getInstance().exceptionCaught(e);
>         }
>     }
>     private static boolean initializeDefaultSocketParameters(InetSocketAddress bindAddress, InetAddress connectAddress) {
>         ServerSocket ss = null;
>         Socket socket = null;
>         try {
>             ss = new ServerSocket();
>             ss.bind(bindAddress);
>             socket = new Socket();
>             socket.connect(new InetSocketAddress(connectAddress, ss.getLocalPort()), 10000);
>             initializeDefaultSocketParameters(socket);
>             return true;
>         } catch (IOException ioe) {
>             return false;
>         } finally {
>             if (socket != null) {
>                 try {
>                     socket.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>             if (ss != null) {
>                 try {
>                     ss.close();
>                 } catch (IOException e) {
>                     ExceptionMonitor.getInstance().exceptionCaught(e);
>                 }
>             }
>        }
>     }
> The _only_ reason why this code exists is to setup the default values for the socket configuration. 
> Not only is this bad code, but also a totally wrong thing to do : in many environment, creating sockets this way will lead to breakages (Applet, etc).
> It as to be fixed urgently.

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