harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-5530) Selector.select() returns exception if network connection is lost
Date Wed, 05 Mar 2008 09:33:40 GMT

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

Tim Ellison closed HARMONY-5530.
--------------------------------


> Selector.select() returns exception if network connection is lost
> -----------------------------------------------------------------
>
>                 Key: HARMONY-5530
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5530
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M4
>         Environment: Only test on Win32, Linux unknown at this time.
>            Reporter: Phil Loats
>            Assignee: Tim Ellison
>
> This problem was seen on version "harmony-jdk-603534"
> When Selector.select() is called with an empty list, then the network connection is lost
- an exception is thrown to the caller.
> This behavior is different from J2SE 1.5 where it continues to wait without throwing
an exception.
> The following test code will show this problem:
> import java.io.IOException;
> import java.nio.channels.Selector;
> public class Test {
> 	public static void main(String[] args) {
> 		Selector selector = null;
> 		
> 		try {
> 			selector = Selector.open();
> 			System.out.println("selector open...");		       
> 		} catch (IOException e) {
> 	    }
> 		    
> 		// Wait for events
> 		while (true) {
> 		    try {
> 		    	// Wait for an event
> 		    	System.out.println("Waiting on selector...");
> 		        selector.select();
> 		    } catch (IOException e) {
> 		        // Handle error with selector
> 		    	e.printStackTrace();
> 		        break;
> 		    }
> 		}
> 		System.out.println("done...");
> 	}
> }
> Start the testcase, it will pause at "Waiting on selector..." message.  Bring down the
network connection ("ipconfig /release" I use), the following exception is thrown:
> selector open...
> Waiting on selector...
> java.net.SocketException: The connection was reset
>         at org.apache.harmony.luni.platform.OSNetworkSystem.readSocketImpl(OSNetworkSystem.java)
>         at org.apache.harmony.luni.platform.OSNetworkSystem.read(OSNetworkSystem.java:89)
>         at org.apache.harmony.nio.internal.SocketChannelImpl.readImpl(SocketChannelImpl.java:459)
>         at org.apache.harmony.nio.internal.SocketChannelImpl.read(SocketChannelImpl.java:377)
>         at org.apache.harmony.nio.internal.PipeImpl$SourceChannelImpl.read(PipeImpl.java:133)
>         at org.apache.harmony.nio.internal.SelectorImpl.processSelectResult(SelectorImpl.java:526)
>         at org.apache.harmony.nio.internal.SelectorImpl.selectInternal(SelectorImpl.java:474)
>         at org.apache.harmony.nio.internal.SelectorImpl.select(SelectorImpl.java:432)
>         at Test.main(Test.java:30)
> done...
> Again, J2SE 1.5 remains paused at "Waiting..." when the network is lost or regained.

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


Mime
View raw message