JDK-4856776 : RMI call remains blocked even after network cable is unplugged in Solaris 8
  • Type: Bug
  • Component: other-libs
  • Sub-Component: corba:orb
  • Affected Version: 1.4.1
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2003-05-01
  • Updated: 2004-02-05
  • Resolved: 2004-12-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.4.1 05Fixed 1.4.2Fixed
Description
When using the simple Helloworld Testcase given as part of the "Getting Started with RMI-IIOP" we unplug the network cable which connects client and server, and wait. Since the cable is unplugged, the RMI call remains blocked forever (we have tested up to 15 minutes). RMI should have thrown an exception at some point here, but it didn't actually throw an exception until the connection was plugged back in. At that point, a Marshal exception was thrown. This behaviour is seen on SOlaris 8 and 9 systems. Surpisingly, on the Windows platform (win2K), the RMI client immeidately gives an exception when the client network cable is plugged out.

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.4.1_05 1.4.2_04 FIXED IN: 1.4.1_05 1.4.2_04 INTEGRATED IN: 1.4.1_05 1.4.2_04 VERIFIED IN: 1.4.1_05 1.4.2_04
14-06-2004

WORK AROUND Extend DefaultSocketFactory and override createSocket and setSoTimeout. Set -Dcom.sun.CORBA.connection.ORBSocketFactoryClass=OwnSocketFactory Without the changes mentioned in the evaluation section the timeout will appear to be 5 times longer that the SoTimeout. ###@###.### 2003-05-28 The problem with the timeout appearing 5 times longer than what is set will be fixed with JDK 1.4.1_04 Here is the source file which sets the time out: ************************************************************ import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; import org.omg.CORBA.ORB; import org.omg.CORBA.COMM_FAILURE; import org.omg.CORBA.CompletionStatus; import com.sun.corba.se.connection.EndPointInfo; import com.sun.corba.se.connection.GetEndPointInfoAgainException; import com.sun.corba.se.connection.ORBSocketFactory; import com.sun.corba.se.internal.core.IOR; import com.sun.corba.se.internal.iiop.EndPointImpl; import com.sun.corba.se.internal.ior.IIOPProfileTemplate ; import com.sun.corba.se.internal.ior.IIOPAddress ; import com.sun.corba.se.internal.orbutil.MinorCodes; public class OwnSocketFactory implements ORBSocketFactory { public OwnSocketFactory() { } public ServerSocket createServerSocket(String type, int port) throws IOException { if (! type.equals(ORBSocketFactory.IIOP_CLEAR_TEXT)) { throw new COMM_FAILURE( "DefaultSocketFactory.createServerSocket only handles " + "IIOP_CLEAR_TEXT, given: " + type, MinorCodes.DEFAULT_CREATE_SERVER_SOCKET_GIVEN_NON_IIOP_CLEAR_TEST, CompletionStatus.COMPLETED_NO); } ServerSocket sc = new ServerSocket(port); return sc; } public EndPointInfo getEndPointInfo(ORB orb, IOR ior, EndPointInfo endPointInfo) { IIOPProfileTemplate temp = ior.getProfile().getTemplate() ; IIOPAddress primary = temp.getPrimaryAddress() ; return new EndPointImpl(ORBSocketFactory.IIOP_CLEAR_TEXT, primary.getPort(), primary.getHost().toLowerCase()); } public Socket createSocket(EndPointInfo endPointInfo) throws IOException, GetEndPointInfoAgainException { Socket sc = new Socket(endPointInfo.getHost(), endPointInfo.getPort()); try { sc.setSoTimeout(30000); // <<---- set the timeout for the socket // Here set to 30 seconds } catch (Exception e) { System.err.println(e); } return sc; } } ###@###.### 2003-06-06
06-06-2003

SUGGESTED FIX --- MessageBase.java Mon May 12 05:50:14 2003 *** 512,536 **** public static void readFully(java.io.InputStream is, byte[] buf, int offset, int size) throws IOException { int n = 0; while (n < size) { int bytecount=0; - int itns=0; - // The while loop here is to workaround a possible bug - // in the Solaris JVM where an "interrupted system call" - // error is thrown as a SocketException instead of being - // retried inside SocketInputStream.read(). - while ( true ) { - try { bytecount = is.read(buf, offset + n, size - n); - break; - } catch ( java.io.IOException ex ) { - if ( itns++ >= 5 ) - throw ex; - } - } if (bytecount < 0) throw new IOException(); n += bytecount; } --- 512,523 ---- ###@###.### 2003-05-29
29-05-2003

EVALUATION There is a workaround in MessageBase.readFully for an old networking bug that has since been fixed. Looks like Bug Id 4178050. Remove the retries to InputStream.read() ###@###.### 2003-05-28 ----------------------------------------- 1.4.1_04 is a security release. This fix has been pushed to 1.4.1_05 ###@###.### 2003-06-27
28-05-2003