You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Ray Chen (JIRA)" <ji...@apache.org> on 2010/03/18 07:08:27 UTC

[jira] Created: (HARMONY-6478) [classlib][luni]Got "The socket is already connected" SocketException on AIX

[classlib][luni]Got "The socket is already connected" SocketException on AIX
----------------------------------------------------------------------------

                 Key: HARMONY-6478
                 URL: https://issues.apache.org/jira/browse/HARMONY-6478
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: AIX
            Reporter: Ray Chen


When ran the following test case, got SocketException says "The socket is already connected"

public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(0);
	int port = ss.getLocalPort();
	byte[] bb = {(byte)1};
        InetAddress address = InetAddress.getLocalHost();
	Socket s = new Socket(address,port,false);
	OutputStream os = s.getOutputStream();
	os.write(bb);
}

The exception trace as following: 
Exception in thread "main" java.net.SocketException: The socket is already connected
        at org.apache.harmony.luni.platform.OSNetworkSystem.sendDatagram2(Native Method)
        at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:571)
        at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:50)
        at CMVC163335.main(CMVC163335.java:32)


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


[jira] Commented: (HARMONY-6478) [classlib][luni]Got "The socket is already connected" SocketException on AIX

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846786#action_12846786 ] 

Mark Hindess commented on HARMONY-6478:
---------------------------------------

Is there already a test case that covers this or do you need to add a regression test?


> [classlib][luni]Got "The socket is already connected" SocketException on AIX
> ----------------------------------------------------------------------------
>
>                 Key: HARMONY-6478
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6478
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: AIX
>            Reporter: Ray Chen
>         Attachments: HY-6478.diff
>
>
> When ran the following test case, got SocketException says "The socket is already connected"
> public static void main(String[] args) throws IOException {
>         ServerSocket ss = new ServerSocket(0);
> 	int port = ss.getLocalPort();
> 	byte[] bb = {(byte)1};
>         InetAddress address = InetAddress.getLocalHost();
> 	Socket s = new Socket(address,port,false);
> 	OutputStream os = s.getOutputStream();
> 	os.write(bb);
> }
> The exception trace as following: 
> Exception in thread "main" java.net.SocketException: The socket is already connected
>         at org.apache.harmony.luni.platform.OSNetworkSystem.sendDatagram2(Native Method)
>         at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:571)
>         at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:50)
>         at CMVC163335.main(CMVC163335.java:32)

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


[jira] Updated: (HARMONY-6478) [classlib][luni]Got "The socket is already connected" SocketException on AIX

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

Ray Chen updated HARMONY-6478:
------------------------------

    Attachment: HY-6478.diff

The attached patch can fix this problem.
The logic seems a little confusing, so I added some comments in it.

Any suggestions are welcome.

Thank you! 

> [classlib][luni]Got "The socket is already connected" SocketException on AIX
> ----------------------------------------------------------------------------
>
>                 Key: HARMONY-6478
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6478
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: AIX
>            Reporter: Ray Chen
>         Attachments: HY-6478.diff
>
>
> When ran the following test case, got SocketException says "The socket is already connected"
> public static void main(String[] args) throws IOException {
>         ServerSocket ss = new ServerSocket(0);
> 	int port = ss.getLocalPort();
> 	byte[] bb = {(byte)1};
>         InetAddress address = InetAddress.getLocalHost();
> 	Socket s = new Socket(address,port,false);
> 	OutputStream os = s.getOutputStream();
> 	os.write(bb);
> }
> The exception trace as following: 
> Exception in thread "main" java.net.SocketException: The socket is already connected
>         at org.apache.harmony.luni.platform.OSNetworkSystem.sendDatagram2(Native Method)
>         at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:571)
>         at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:50)
>         at CMVC163335.main(CMVC163335.java:32)

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


[jira] Updated: (HARMONY-6478) [classlib][luni]Got "The socket is already connected" SocketException on AIX

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

Ray Chen updated HARMONY-6478:
------------------------------

    Attachment: HY-6478_TestCase.diff

Hi Mark,
Here is the regression test.

And I will try to find a better place to put the check logic.

Thank you for your suggestions!

> [classlib][luni]Got "The socket is already connected" SocketException on AIX
> ----------------------------------------------------------------------------
>
>                 Key: HARMONY-6478
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6478
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: AIX
>            Reporter: Ray Chen
>         Attachments: HY-6478.diff, HY-6478_TestCase.diff
>
>
> When ran the following test case, got SocketException says "The socket is already connected"
> public static void main(String[] args) throws IOException {
>         ServerSocket ss = new ServerSocket(0);
> 	int port = ss.getLocalPort();
> 	byte[] bb = {(byte)1};
>         InetAddress address = InetAddress.getLocalHost();
> 	Socket s = new Socket(address,port,false);
> 	OutputStream os = s.getOutputStream();
> 	os.write(bb);
> }
> The exception trace as following: 
> Exception in thread "main" java.net.SocketException: The socket is already connected
>         at org.apache.harmony.luni.platform.OSNetworkSystem.sendDatagram2(Native Method)
>         at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:571)
>         at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:50)
>         at CMVC163335.main(CMVC163335.java:32)

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


[jira] Commented: (HARMONY-6478) [classlib][luni]Got "The socket is already connected" SocketException on AIX

Posted by "Ray Chen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846788#action_12846788 ] 

Ray Chen commented on HARMONY-6478:
-----------------------------------

Hi Mark,
Do you think the solution is reasonable?  If yes, I will try to give a
test case.




-- 
Regards,

Ray Chen


> [classlib][luni]Got "The socket is already connected" SocketException on AIX
> ----------------------------------------------------------------------------
>
>                 Key: HARMONY-6478
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6478
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: AIX
>            Reporter: Ray Chen
>         Attachments: HY-6478.diff
>
>
> When ran the following test case, got SocketException says "The socket is already connected"
> public static void main(String[] args) throws IOException {
>         ServerSocket ss = new ServerSocket(0);
> 	int port = ss.getLocalPort();
> 	byte[] bb = {(byte)1};
>         InetAddress address = InetAddress.getLocalHost();
> 	Socket s = new Socket(address,port,false);
> 	OutputStream os = s.getOutputStream();
> 	os.write(bb);
> }
> The exception trace as following: 
> Exception in thread "main" java.net.SocketException: The socket is already connected
>         at org.apache.harmony.luni.platform.OSNetworkSystem.sendDatagram2(Native Method)
>         at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:571)
>         at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:50)
>         at CMVC163335.main(CMVC163335.java:32)

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


[jira] Commented: (HARMONY-6478) [classlib][luni]Got "The socket is already connected" SocketException on AIX

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-6478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846873#action_12846873 ] 

Mark Hindess commented on HARMONY-6478:
---------------------------------------

I've not had a good look at the code but my initial impression is that the solution is *not* reasonable.  We should know if we are connected or not because we will have called "connect".  We shouldn't have to try it and see if it fails (with hopefully the failure we expect) and then try again.  However, a regression test will be required regardless of how we solve the problem.


> [classlib][luni]Got "The socket is already connected" SocketException on AIX
> ----------------------------------------------------------------------------
>
>                 Key: HARMONY-6478
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6478
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: AIX
>            Reporter: Ray Chen
>         Attachments: HY-6478.diff
>
>
> When ran the following test case, got SocketException says "The socket is already connected"
> public static void main(String[] args) throws IOException {
>         ServerSocket ss = new ServerSocket(0);
> 	int port = ss.getLocalPort();
> 	byte[] bb = {(byte)1};
>         InetAddress address = InetAddress.getLocalHost();
> 	Socket s = new Socket(address,port,false);
> 	OutputStream os = s.getOutputStream();
> 	os.write(bb);
> }
> The exception trace as following: 
> Exception in thread "main" java.net.SocketException: The socket is already connected
>         at org.apache.harmony.luni.platform.OSNetworkSystem.sendDatagram2(Native Method)
>         at org.apache.harmony.luni.net.PlainSocketImpl.write(PlainSocketImpl.java:571)
>         at org.apache.harmony.luni.net.SocketOutputStream.write(SocketOutputStream.java:50)
>         at CMVC163335.main(CMVC163335.java:32)

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