You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Sergey Dmitriev (JIRA)" <ji...@apache.org> on 2007/06/06 16:58:26 UTC

[jira] Created: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

[classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
------------------------------------------------------------------------------------

                 Key: HARMONY-4077
                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: linux only
            Reporter: Sergey Dmitriev


Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.

The following functions:
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
 hysock_select_read
 getNextNetlinkMsg
 hysock_connect_with_timeout
 
use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.

One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.


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


[jira] Updated: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

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

Sergey Dmitriev updated HARMONY-4077:
-------------------------------------

    Attachment: 4077.patch

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>         Attachments: 4077.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Resolved: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

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

Alexei Zakharov resolved HARMONY-4077.
--------------------------------------

    Resolution: Fixed

Sergey, thanks for the patch - looks good in general. However, I have a few comments - please see below.

1. I think there is no great need to remove the content of hysock_fdset_init(). It's a part of portlib and user may want to use it in conjunction with hysock_select() that still uses system select(). Moreover, if we remove the content of this function the description becomes completely outdated and misleading. IMO such a step can be a part of bigger procces of redesign of portlib if you suppose that select() is unsafe. I don't think we should do it here, in this JIRA.

2. I have updated hysock_select_read() in hysock.c a bit. The function 
description states: "If the timeout is 0, skip this function (and thus the caller of a subsequent read operation may block)". So I've corrected the code to reflect this behavior. BTW it looks like the "accept" parameter isn't used at all.

3. Timeout issues (most important): 
hysock_connect_with_timeout() in hysock.c:
in the original code timeout was truncated to be less or equal to 100 milliseconds; fixed

selectRead() in OSNetworkSystemLinux.c:
the original code treats the value uSecTime parameter as a number of microseconds rather than milliseconds; fixed 

hysock_select_read() in hysock.c:
Looks like the timeout convertion from (sec, microsec) -> millisec
"sec * 1000 + microsec / 1000"
wasn't completely correct since it converts (0, 1) to 0 but zero timeout has a specific meaning. The following LUNI tests constantly fails because of this issue:
org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.testProxyConnection
.testProxyAuthConnection
.testConsequentProxyConnection
.testProxyAuthConnection_doOutput
.testProxyConnection_Not_Found_Response

java.lang.Exception: java.io.IOException: Connection was closed at 
org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.doInteraction(HttpsURLConnectionTest.java:883)
at org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.doInteraction(HttpsURLConnectionTest.java:829)
at org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest.testProxyConnection(HttpsURLConnectionTest.java:434)
at java.lang.reflect.AccessibleObject.invokeV(AccessibleObject.java:25)
Caused by: java.io.IOException: Connection was closed
at org.apache.harmony.xnet.provider.jsse.SSLSocketImpl.doHandshake
(SSLSocketImpl.java:760) 
at  org.apache.harmony.xnet.provider.jsse.SSLSocketImpl.startHandshake
(SSLSocketImpl.java:438)
at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.wrapConnection(HttpsURLConnection.java:433)
at 
org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.connect(HttpsURLConnection.java:40)
at 
org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.connect(HttpsURLConnection.java:148)
at 
org.apache.harmony.luni.tests.internal.net.www.protocol.https.HttpsURLConnectionTest$ClientConnectionWork.run(HttpsURLConnectionTest.java:1216)

4. java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl() in OSNetworkSystemLinux.c
I've made small correction to the code to let it better follow the original behavior.

5. I've seen that some sort of select() is used also in the code for windows version of "hysock.c". Is the described problem UNIX-only or we should look / rework Windows code as well?

Reworked version of your patch was applied at the repository revision 545748. Please verify it is ok (if it is) and solves the original issue.

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Resolved: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

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

Alexei Zakharov resolved HARMONY-4077.
--------------------------------------

    Resolution: Fixed

Yeah, thanks Sergey. I've missed that negative values are possible in selectRead. Slightly modified version of your new patch applied at the revision 548725. Please check. 

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch, 4077_2.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Commented: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505749 ] 

Alexei Zakharov commented on HARMONY-4077:
------------------------------------------

Sergey, am I right in my understanding that the original issue is not reproducible on SLES 9 and we may close this JIRA as fixed?

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Updated: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

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

Sergey Dmitriev updated HARMONY-4077:
-------------------------------------

    Attachment: 4077_2.patch

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch, 4077_2.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Closed: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

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

Alexei Zakharov closed HARMONY-4077.
------------------------------------


Great! Issue closed.

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch, 4077_2.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Assigned: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

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

Alexei Zakharov reassigned HARMONY-4077:
----------------------------------------

    Assignee: Alexei Zakharov

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Commented: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

Posted by "Sergey Dmitriev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505904 ] 

Sergey Dmitriev commented on HARMONY-4077:
------------------------------------------

Alexei, as I see the last version (r548279) is not good. I mean the
simple test (simple server which calls accept() and read()) does not
work. See below for the server3.java.

As it turned out the problem is in the selectRead(int uSecTimeout)
which takes timeout in millis despite of the naming. For example
Selector.select(int timeout) takes timeout in millis and passes it
down to selectRead(int). Note the Selector.select() calls
selectRead(-1). So in this case -1 disappears after
TO_MILLIS(uSecTimeout).

Please see the attached 4077_2.patch and server3.java:

import java.net.*;
import java.nio.*;
import java.nio.channels.*;

public class server3 {

    static int port = 9999;

    public static void main(String args[]) throws Exception {
        ServerSocketChannel sch = ServerSocketChannel.open();
        sch.socket().bind(new InetSocketAddress(port));

        for (;;) {
            System.err.print("listening... ");
            SocketChannel ch = sch.accept();
            System.err.println("accepted.");

            try {
                System.err.print("reading...");
                ByteBuffer buf = ByteBuffer.allocate(1);
                while (ch.read(buf) != -1) {
                    System.err.print("*");
                    buf.flip();
                }
                System.err.println("Done.");
            } finally {
                ch.close();
            }
        }
    }
}

Just launch "java server3" and execute "telnet localhost 9999" in
another shell and tap ENTER couple of times.


> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch, 4077_2.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Commented: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

Posted by "Sergey Dmitriev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505590 ] 

Sergey Dmitriev commented on HARMONY-4077:
------------------------------------------

Alexei, thanks for taking time and handling this issue. As I see that was not a straightforward one.
As for this issue I want to confirm that it looks like select() has been replaced with poll().


> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Reopened: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

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

Sergey Dmitriev reopened HARMONY-4077:
--------------------------------------


Alexei, please see my last comment.

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch, 4077_2.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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


[jira] Commented: (HARMONY-4077) [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE

Posted by "Sergey Dmitriev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506851 ] 

Sergey Dmitriev commented on HARMONY-4077:
------------------------------------------

I confirm that the code is fine now. Thanks!

> [classlib][portlib] socket related functions incorrectly work in socket > FD_SETSIZE
> ------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4077
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4077
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: linux only
>            Reporter: Sergey Dmitriev
>            Assignee: Alexei Zakharov
>         Attachments: 4077.patch, 4077_2.patch
>
>
> Socket related functions incorrectly work with sockets if socket no > FD_SETSIZE. On "SUSE LINUX Enterprise Server 9" FD_SETSIZE is 1024.
> The following functions:
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
>  Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
>  hysock_select_read
>  getNextNetlinkMsg
>  hysock_connect_with_timeout
>  
> use system select() to wait for event on only one file descriptor (socket). In case socket number is greater than maximum fdset_t size (FD_SETSIZE) we can have SIGSEGV. Satellite functins FD_SET, FD_ISSET, FD_CLR can cause SIGSEGV as well.
> One of possible solutions here can be to use poll() instead of select() since we're talking about wait for event on the single file descriptor.

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