Hi,
I'm using Jonas2.2.6 with RMI under jdk1.2.2_004.
When I deployed two stateful Session beans, under moderate stress
I got the following error:
java.rmi.NoSuchObjectException: no such object in table

I did some tests with trial stateful Session bean and trial clients.
In this test one client first creates an EJB, then invokes some methods
and finally invokes the remove() method.
The second client creates another Bean, then waits for twenty minutes,
and finally invokes one business method of the Bean.
During the invocation of the business method, the second client catches
the error "java.rmi.NoSuchObjectException: no such object in table".

I found the cause of the error is that, while the second client is waiting,
the distributed GC of RMI invokes the unreferenced() method on the remote object
of the first client. In fact both the clients were sharing the same server-side
instance of the remote object because of the Session Bean connection pooling
implemented in Jonas. The first client actually created the new instance of the
Bean Object, while the second client got a new remote reference to the same instance
of Bean Object, pooled from the Free Session Pool (the free_session_pool array
in JSessionHome.java). In response to the first client's remove() call, Jonas
just unexported the Bean Object (using the RMI unexport() method).
When the second client calls the create() method, Jonas exports again the same
instance. When the DGC timeout of RMI expires, referring to the first export() of
the Bean Object, the unreferenced() method of the Bean Object gets called on the object
that is being used by the second client. In response to this event, Jonas calls
unexport(). When the second client tries to call a
business method on an unexported object, it gets the NoSuchObjectException.

One workaround to the problem is to put the Session Bean in the Free Bean Pool only
when unreferenced() gets called by DGC and not directly when ejbRemove() gets called by
a client. This solution has a drawback: one object can be put in the pool only when
DGC notifies that an object has no more live references in any client.
Unfortunately there happens to be a bug in JDK < 1.3.0_02 that forces this event
to happen only on timeouts even when one object gets explicitly unexported() on the
server side. (See http://developer.java.sun.com/developer/bugParade/bugs/4331349.html)
So this workaround has the side effect to let an object be reused only after the DGC
timeout, even if a client has called ejbRemove(). Of course, using JDK 1.3.0_02 and 
after
does not show any more this nasty side effect.


Andrea Ravagli

*************************************************************************
Ai sensi della legge n.ro  675/96, si precisa che le informazioni contenute
in questo messaggio e negli eventuali  allegati sono riservate e per uso
esclusivo del destinatario. Persone diverse dallo stesso non possono
copiare o distribuire il messaggio a terzi. Chiunque riceva questo
messaggio per errore, è pregato di distruggerlo e di informare
immediatamente [EMAIL PROTECTED]

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to