[Pogamut-list] Proper Server Termination

jakub.gemrot pogamut-forum at diana.ms.mff.cuni.cz
Thu Apr 28 07:41:50 CEST 2011


Re: Proper Server Termination

Author: jakub.gemrot

> I actually did use the profiler, but to look at which Threads were running the whole time. In particular,
> with each new server, several threads are created, but some of these are still around when the server and
> its bots are killed. Some of these were mine, and I've dealt with them. The threads on your end that are not
> going away are threads that start with:
>
> RMI TCP Connection
> JMX server connection timeout
> ClientNotifForwarder

If those are all threads that are hanging in the air, than JMX is to blame... nothing else at all. I'm not expert on JMX implementation
and it certainly worries me a lot that it is so hard to use properly, sadly. Well are you using following code in your Main class?

{CODE()}
public static void main(String[] args) {
  // NO CODE HERE
  try{
      ...
      waitTillAllJobsAreDone();
  } finally {
    PogamutPlatform.getPlatform().close()
  }
  // NO CODE HERE -> JVM IS GOING TO BE SHUTDOWN AFTER THIS POINT
}
{CODE}

If you do not close PogamutPlatform, RMI registry won't never ever shutdown.

> Actually, Tokens seem to be leaking too, as are UnrealIds and something called WeakReference. I know that
> UnrealId's contain Strings, and I'm guessing Tokens do too, so that explains why Strings are leaking.

WeakReferences should be gc()ed finally.

Regarding Tokens and UnrealIds, yes you're right, they are leaking - there is Singleton (manager) for them that
is keeping them all, not letting even one of them go...

I could provide you with "clear()" method. But that could have disastrous effects when used in the middle of
Pogamut agent's executions as Maps will stop working correctly resulting in strange errors, crashes, misbehaviour, etc.

>However, the main reason I'm doing all of this is for the Humanlike Bots/BorPtize competitions, which use a slightly
> modified version of Gamebots.

We're sorry but BotPrize is fixing GameBots implementation for long time and we need GB to be flexible as many errors
can be solved by just adjusting them or adding some more attribs to their messages, etc. Thus current version of Pogamut
is not suitable for BotPrize competition. I think that you will have to use older versions of Pogamut. Does version 3.1 work?

========================

Bit different side of view, what is the most problematic point about "server termination"? Is it the case that you just can't 
make JVM to shutdown? I mean, our usual scenario for large simulations / evolutions / tournaments goes like this:

You create a batch file that will be sequentially executing JVMs and each JVM will

1) instantiate its own UCCWrapper
2) perform one task
3) terminate

Batch file will always wait till previous JVM exits ... thus you won't suffer from leaks / GB2004 bugs related to bots staying in the game
after UT2004Bot is killed, etc.

Best,
Jimmy

-- 
Reply Link: <http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?forumId=4&comments_reply_threadId=4&comments_parentId=682&post_reply=1#form>





More information about the Pogamut-list mailing list