You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Niklas Gustavsson (JIRA)" <ji...@apache.org> on 2009/03/01 16:57:12 UTC

[jira] Created: (HARMONY-6105) Harmony throws exception when using SO_TIMEOUT on socket

Harmony throws exception when using SO_TIMEOUT on socket
--------------------------------------------------------

                 Key: HARMONY-6105
                 URL: https://issues.apache.org/jira/browse/HARMONY-6105
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: Harmony trunk
uname -a
Linux niklas-laptop 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686 GNU/Linux

            Reporter: Niklas Gustavsson


As discussed on this thread http://markmail.org/message/6zv42jp4yivpd7ns Harmony throws an exception when trying to read from a socket with SO_TIMEOUT set. Also, the provided test case lead to the discovery of two related bugs found by Mark Hindess described here http://markmail.org/message/7r2k7va362ofkwld

Test case (requires Apache FtpServer, MINA and SLF4J on the classpath):
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.channels.Channels;

import org.apache.ftpserver.FtpServer;
import org.apache.ftpserver.FtpServerFactory;
import org.apache.ftpserver.listener.ListenerFactory;


public class HarmonyFtpClient {

   public static void main(String[] args) throws Exception {

       FtpServerFactory fsf = new FtpServerFactory();
       ListenerFactory listenerFactory = new ListenerFactory();
       listenerFactory.setPort(2121);

       fsf.addListener("default", listenerFactory.createListener());

       FtpServer server = fsf.createServer();
       server.start();

       try {
           Socket socket = new Socket();
           socket.connect(new InetSocketAddress("localhost", 2121));
           socket.setSoTimeout(10000);
           socket.getInputStream().read();
       } finally {
           server.stop();
       }
   }
}


Stacktrace:
java.net.SocketException: No such file or directory
       at org.apache.harmony.luni.platform.OSNetworkSystem.read(OSNetworkSystem.java)
       at org.apache.harmony.luni.net.PlainSocketImpl.read(PlainSocketImpl.java:557)
       at org.apache.harmony.luni.net.SocketInputStream.read(SocketInputStream.java:61)
       at HarmonyFtpClient.main(HarmonyFtpClient.java:27)


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