LARG / HFO

Half Field Offense in Robocup 2D Soccer
MIT License
228 stars 93 forks source link

How to reconnect to the server? #96

Open saikalyan9981 opened 4 years ago

saikalyan9981 commented 4 years ago

Hello @mhauskn , I have an issue with reconnecting to the server and avoiding SERVER_DOWN. Is it possible to reconnect to the server when it is down? In my case after running for a few (33,000) episodes: It's throwing error as

base_right 3: waited 5 seconds. server down??
base_right 3: finished.
base_right 3: finished.
base_right 3: finished.
base_right 3: finished.
(...)

I cannot understand why the status of HFOEnvironment() is becoming SERVER_DOWN. I tried to increase the serverWaitSeconds to 50, program worked perfectly for more episodes this time, but still, eventually, its status became SERVER_DOWN.

So I tried to reconnect to the server when the status is SERVER_DOWN, but it is throwing this error:

HFO/src/strategy.cpp 198: already initialized.

Is there any workaround for my case? also any plausible explanation of why status is becoming SERVER_DOWN?

I saw an issue for the workaround of Re-starting hfo server , is it the only way I can do it or can I connect to the server multiple times?

mhauskn commented 4 years ago

Hi - a couple of thoughts - perhaps the rcssserver is dying after some time. If this is the case, you'll need to actually restart the rcssserver process before you'll be able to connect to it. Next time you observe this crash, I'd suggest looking at your processes to see if the rcssserver is still alive or not. You may also be able to find logs from the rcssserver at a path like ~/.rcssserver (memory is a bit fuzzy as to the exact path name, but these logs may help to diagnose what the cause of the server going down in the first place was).

saikalyan9981 commented 4 years ago

Thank you for the suggestion and quick response. Indeed you were right the rcssserver is dying after some time. Restarting the server should help (as of now I'm using serverWaitSeconds of 500 sec, and everything seems fine). But I was unable to detect the problem of the server going down. The ~/.rcssserver has these files CSVSaver.conf, player.conf, server.conf. Were you trying to suggest the .rcg, .rcl files, I couldn't extract any information of server down from them, they were normal.

huzhejie commented 3 years ago

@saikalyan9981 I can not find the way to set serverWaitSeconds. I would appreciate it if you could tell me it

saikalyan9981 commented 3 years ago

@huzhejie In HFO.cpp, config add this line config.set_serverWaitSeconds(500);//add