-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
windows_nt
Name: skT45625 Date: 05/18/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
or
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Server VM (build 2.0fcs-E, mixed mode)
Orb forgets to send reply messages.
Clients are hanging or throwing exception:
org.omg.CORBA.MARSHAL: minor code: 1398079496 completed: Maybe
at java.lang.Class.newInstance0(Native Method)
at java.lang.Class.newInstance(Class.java:237)
at
com.sun.corba.se.internal.iiop.ReplyMessage.getSystemException(ReplyMessage.java
:93)
at
com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemException(ClientRespo
nseImpl.java:82)
at
com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.java:191)
at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:294)
at Jdktest._ARemoteObjectStub.testop(_ARemoteObjectStub.java:35)
at Jdktest.Clt.run(Clt.java:56)
at Jdktest.Clt.main(Clt.java:38)
I have implemented a server using jidl. Everything is working fine, as long as
only one client is using it. On putting higher load of multiple clients to the
server, randomly single or often pairs of clients are hanging or throwing the
exception described above. The probability for a clients to die seams to be very
high when other applications require system resources.
The example code:
File "ARemoteObject.idl":
module Jdktest
{
interface ARemoteObject
{
void testop( in string p1, in long p2 );
string getClientName();
};
};
File "ARemoteObjectExt.java":
package Jdktest;
import java.io.*;
import java.util.Vector;
public class ARemoteObjectExt extends _ARemoteObjectImplBase
{
public final
void testop(String p1, int p2)
{
try
{
// Call method from target implementor.
implementor.testop(p1, p2);
}
catch( java.lang.Exception ex)
{
ex.printStackTrace();
}
}
public final
String getClientName()
{
return implementor.getClientName();
}
public
ARemoteObjectExt(ARemoteObjectImpl implementor)
{
this.implementor = implementor;
}
ARemoteObjectImpl implementor = null;
}
File "ARemoteObjectImpl.java"
package Jdktest;
import java.io.*;
import java.util.Vector;
public class ARemoteObjectImpl
{
public final
void testop(String p1, int p2)
{
System.out.println("-> ARemoteObjectImpl.testop(" + p1 + "," + p2 + ")"
);
// sleep between 0 and 100 ms
int ms = (int) (Math.random() * 100);
try
{
waste = new byte[100000];
Thread.sleep( ms );
}
catch (InterruptedException x)
{
}
System.out.println("<- ARemoteObjectImpl.testop(" + p1 + "," + p2 + ")"
);
}
private static int cltIdx = 0;
private String[] replyPool = null;
private int ringBufferPtr = 0;
private int ringBufferSize = 10;
private byte[] waste;
public final
String getClientName()
{
return "clt #" + (cltIdx++);
}
public
ARemoteObjectImpl()
{
}
}
File "Srv.java"
package Jdktest;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
import java.io.*;
import java.util.*;
public class Srv
{
private ORB orb = null;
private ARemoteObjectExt ext = null;
private NamingContext _nc = null;
private java.lang.Object sync = new java.lang.Object();
public Srv(String[] args)
{
System.out.println("Preparing...");
try
{
ext = new ARemoteObjectExt ( new ARemoteObjectImpl() );
orb = ORB.init(args, new java.util.Properties() );
orb.connect(ext);
org.omg.CORBA.Object in_obj = null;
in_obj = orb.resolve_initial_references("NameService");
_nc = NamingContextHelper.narrow(in_obj);
NameComponent[] contextName = new NameComponent[1];
contextName[0] = new NameComponent("myJdktest",
"");
try
{
NamingContext froggerContext =
_nc.bind_new_context(contextName);
}
catch (AlreadyBound ex)
{
System.out.println("context already bound");
}
System.out.println("bind object");
_nc.rebind(contextName, ext);
System.out.println("Preparing done");
}
catch (Exception x)
{
x.printStackTrace();
}
}
public final
void run()
{
System.out.println("waitForClientInvocations");
try
{
synchronized(sync)
{
sync.wait();
}
}
catch( java.lang.InterruptedException ex )
{
System.out.println("Interrupt");
}
}
public static final void main(String[] args)
{
Srv srv = new Srv(args);
srv.run();
}
}
File "Clt.java"
package Jdktest;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CosNaming.*;
import org.omg.CORBA.*;
public class Clt
{
private ARemoteObject remotePartner = null;
static private String cltName = null;
public Clt(String args[]) throws Exception
{
System.out.println("Setting up ...");
ORB orb = ORB.init(args, new java.util.Properties() );
org.omg.CORBA.Object n =
orb.resolve_initial_references("NameService");
NamingContext _nc = NamingContextHelper.narrow(n);
System.out.println("got nameservice");
NameComponent[] contextName = new NameComponent[1];
contextName[0] = new NameComponent("myJdktest", "");
org.omg.CORBA.Object obj = _nc.resolve(contextName);
System.out.println("got remote object");
remotePartner = ARemoteObjectHelper.narrow(obj);
System.out.println("Setting up finished");
}
public static void main(String args[])
{
try
{
Clt clt = new Clt(args);
clt.run();
}
catch (Exception x)
{
x.printStackTrace();
}
}
public void run()
{
System.out.println("Running...");
int i = 0;
cltName = remotePartner.getClientName();
while (true)
{
System.out.println("-> " + cltName + " starts operation
#" + i);
remotePartner.testop(cltName, i);
System.out.println("<- " + cltName + " finished
operation #" + i);
++i;
}
}
}
Start tnameserv.
Start the Srv-class using java -Xmx180m Jdktest.Srv
When the Srv is ready, start some (e.g. 10-20) Clients using java -Xmx5m
Jdktest.Clt
You will see all clients working. After a while some of the clients will simply
stop. In the server output you can see, that the ARemoteObjectImpl.testop method
is left correctly, but the corrosponding client gets no response.
In order to enforce the effect, do some other work on the computer (open a
memory consuming application) or let the test suit run in the background and do
your usual work.
This testsuite is a constructed one. We are suffering the problem in our project
which is certainly much more complex than this one. But there the effect is much
more predictable than on the testsuite. On the real application a complete set
of 6 clients gets hanging within 20 minutes.
On jdk 1.2.2 the problem does not appear. Using -Xincgc on jdk 1.3 reduces the
problem but does not eliminate it.
(Review ID: 104999)
======================================================================
- duplicates
-
JDK-4321532 race condition in IIOPConnection.java
-
- Resolved
-