aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RMI Server Hang Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RMI Server Hang" Watch "RMI Server Hang" New topic
Author

RMI Server Hang

Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hello Everybody,

I am curious if anybody has seen a similar behavior.
Currently I have a Sun SunBlade 2000 SPARC system running Solaris 10 with JDK 1.6.0_18.
Typically I run my RMI server here inside the NetBeans 6.8 IDE.

Most of the development and my network client I run it on Windows XP with JDK 1.6.0_17
using the latest Eclipse Java EE IDE.

Sometimes I leave my Sun on with my RMI server running overnight and the next morning
when I try to connect a network client I am unable to connect. However, the RMI server seems
to be running and still listening for incoming connections:


To solve the problem I just restart the RMI server and then everything works.

Has anybody seen similar behavior?
I still have not created my runme.jar and I wonder if this happens because I am running
inside the NetBeans IDE.

Did a Google Search and the only thing I was able to find was this FAQ.
and get a trace as indicated in B.7.

Thoughts? Comments?

Thanks in advance,


Carlos.


SCSA, OCA, SCJP 5.0, SCJD, CCDH, CCAH http://www.linkedin.com/in/carlosamorillo
Karthik Shiraly
Ranch Hand

Joined: Apr 04, 2009
Posts: 532
    
    7
Hi,

What exception do you see on the client side?

Enable FINEST level java logging (-Djava.util.logging.config.file=logging.properties) for rmiregistry, server and client, and see if there's any clue.
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi Karthik,


I will do some debugging about this in the next couple of days.
I have already added the debugging flag you suggested to all the server and client VMs.
The registry is started programatically by the server.

I have only observed this behavior after I leave the server running idle for hours.

Will keep you posted.

Thanks,

Carlos.
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi Karthik,

I just was able to reproduce the Server Hang again.
This is the Exception I get on the Client:





Not sure if the debugging option you suggested earlier has had any effect.
I have not seen any other logging output in the Eclipse console.

Just in case, I am still running everything inside an IDE: Server in NetBeans and Client in Eclipse
and I still have not run rmic.


Thanks,


Carlos.
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi again,


I found some interesting things with Google about this issue.

Like this in Sun forums and here.

To make a long story short, looks like when I leave my RMI Server idle, eventually its object gets Garbage Collected,
and the solution is a strong reference to it or to make the reference to it static.

Has anybody seen this before?
I doubt I am the first one.

The last paragraph here in the RMI spec makes it sound like this is something normal.


Any comments? Thoughts?


Thanks,


Carlos.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5545
    
  13

Hi Carlos,

Because your title was "RMI Server Hang" (because you didn't know what was going on exactly), I totally didn't think about it. But after you posting the real exception, I totally remember it again I had the same issue and everything about it is described here. So you didn't try the search engine of this forum, otherwise you had found that thread yourself

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Hi Roel,

I am glad I am trying to be as thorough as you are testing my SCJD assignment project that I am running
into some of the same problems you had in the past. Hopefully my results will be as close and
successful as you did!


I did use the Java Ranch SCJD forum search using "RMI Server Hang" and "RMI Server not responding"
but I didn't find anything related.
Also the nature of the problem since you still see the RMI registry still listening on port 1099 according
to netstat and my fault, the exception was hidden by the fact that my GUI Controller was catching it and
wrapping it throwing a GUI Controller exception without including the message of the original exception
before throwing the GUI Controller exception.


After some Eclipse debugging when I reproduced the problem and adding an
Exception printStackTrace() call before I throw my GUI Controller exception I was
finally able to narrow the problem.

I did the changes last night and used the -Djava.rmi.server.logCalls=true flag you had in your
posting (The one recommended by Karthik didn't produce any output) and just test it again and now I get:

run:
Apr 13, 2010 10:58:52 PM suncertify.gui.ServerStarter <init>
INFO: Starting RMI registry on port: 1099
Apr 13, 2010 10:58:54 PM suncertify.gui.ServerStarter <init>
INFO: Server started.
Apr 13, 2010 10:59:51 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(1)-192.168.1.103: [192.168.1.103: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(java.lang.String)]
Apr 13, 2010 10:59:51 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(2)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 13, 2010 10:59:52 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(2)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 13, 2010 11:00:20 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(2)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 13, 2010 11:00:47 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(3)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 13, 2010 11:35:56 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(4)-192.168.1.103: [192.168.1.103: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(java.lang.String)]
Apr 13, 2010 11:35:56 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(5)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 13, 2010 11:35:56 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(5)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 13, 2010 11:39:59 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(6)-192.168.1.103: [192.168.1.103: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(java.lang.String)]
Apr 13, 2010 11:39:59 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(7)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 13, 2010 11:39:59 PM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(7)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 14, 2010 7:26:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(8)-192.168.1.103: [192.168.1.103: sun.rmi.registry.RegistryImpl[0:0:0, 0]: java.rmi.Remote lookup(java.lang.String)]
Apr 14, 2010 7:26:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(9)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 14, 2010 7:26:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(9)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 14, 2010 7:29:22 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(10)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 14, 2010 7:30:23 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(11)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 14, 2010 7:31:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(12)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 14, 2010 7:33:03 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(13)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 14, 2010 7:33:16 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(13)-192.168.1.103: [192.168.1.103: suncertify.remote.RemoteBusinessServicesImpl[f457d05:127fa4140d5:-7fff, 5764474861368025571]: public abstract java.util.List suncertify.domain.BusinessServices.search(suncertify.domain.SearchCriteria) throws java.rmi.RemoteException]
Apr 14, 2010 7:36:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(14)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 14, 2010 7:41:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(15)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 14, 2010 7:46:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(16)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 14, 2010 7:51:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(17)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 14, 2010 7:56:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(18)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 14, 2010 8:01:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(19)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]
Apr 14, 2010 8:06:56 AM sun.rmi.server.UnicastServerRef logCall
FINER: RMI TCP Connection(20)-192.168.1.103: [192.168.1.103: sun.rmi.transport.DGCImpl[0:0:0, 2]: java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)]


Problem solved!


Thanks,


Carlos.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5545
    
  13

Carlos Morillo wrote:I am glad I am trying to be as thorough as you are testing my SCJD assignment project that I am running
into some of the same problems you had in the past.

To be honest: I didn't test the RMI stuff thoroughly, experiencing this issue was just a coincidence. I started the RMI server, put the assignment on hold because football was on and afterwards trying to use the application again. But my Data class and business service implementation had a 100% test coverage for every possible situation (including normal execution, wrong arguments passed to methods, expected exceptions,...)

Kind regards,
Roel
Andy Jung
Ranch Hand

Joined: Feb 07, 2010
Posts: 150
Hi guys,

I had the same problem, but after having referenced the two remote objects in a static variable, it worked fine.
No remote exceptions anymore, even overnight and during watching all the great fc-bayern soccer matches .

Kind regards,
Andy



SCJP, SCJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5545
    
  13

Andy Jung wrote:two remote objects
Why 2? Normally marking 1 of them as a static variable should be enough
Andy Jung
Ranch Hand

Joined: Feb 07, 2010
Posts: 150
yes correct, I have two remote objects totally and only one is hold as a static variable. I should study my choices.txt thoroughly before taking the written exam in 2 weeks.
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

Andy Jung wrote:I had the same problem, but after having referenced the two remote objects in a static variable, it worked fine.


I do not understand why you would have to make static two different objects.

I am using a thin client approach, therefore I have a BusinessServices object that exposes only 2 methods:

- Book Room
- Search Rooms

So from one class that takes care of Starting the RMI Server I have:

Andy Jung
Ranch Hand

Joined: Feb 07, 2010
Posts: 150
Carlos Morillo wrote:
I do not understand why you would have to make static two different objects.


... you probably do understand if you read my post before yours which clarifies:

I have two remote objects totally and only one is hold as a static variable
Carlos Morillo
Ranch Hand

Joined: Jun 06, 2009
Posts: 221

You are not getting your message across about how you architected/designed this part
of your application.

If you have 2 separate different remote objects (that still I don't see the need and why)
I don't understand why you do have just a single static reference. It is not clear.

Likely other people like Roel and the assessor at Sun-Oracle will have a hard time understanding
your explanation ...

Anyway ... Good Luck,


Carlos.
Andy Jung
Ranch Hand

Joined: Feb 07, 2010
Posts: 150
In my solution I need two objects implementing the Remote interface (= the remote objects to me).
This has nothing to do with objects being registered to the RMI-registry , I also have only one object (the Business Model)
which is registered to the registry and declared as static variable.

The reason why I need two objects implementing the Remote interfaces is because I use MVC pattern in a push manner:
That is:
1. The local controller gets informed of any user gestures made by a client (for example book).
2. The controller informs the remote Business model (= service) and delegates the action to it
3. The model performs operations and informs any registered views (each one associated to a local client)
4. Since each view is associated with a client gui on the network, the view has to be defined remote as well.

So what's actually wrong having two remote objects? I think there's no alternative if you want to implement MVC in a push like manner.
And I only need one static reference to the model, because the model holds a list of registered views, and if the model cannot be garbage collected the views contained by the model cannot be either.

So please tell me, what's actually wrong with my approach?
 
 
subject: RMI Server Hang