TeamFightingICE/FightingICE

Can I run FTG on a server without display devices?

Booo0m opened this issue · 1 comments

I want to train my AI via Gym API on a server without display devices. I have used the '--disable-window' argument but the program crashed if I close the X11 server:

MoTTY X11 proxy: unable to connect to forwarded X server: Network error: Connection refused
[LWJGL] GLFW_PLATFORM_ERROR error
Description : X11: Failed to open display localhost:10.0
Stacktrace :
org.lwjgl.glfw.GLFW.glfwInit(GLFW.java:740)
manager.DisplayManager.initialize(DisplayManager.java:69)
manager.DisplayManager.start(DisplayManager.java:50)
Main.main(Main.java:22)
Exception in thread "main" java.lang.IllegalStateException: Unable to initialize GLFW
at manager.DisplayManager.initialize(DisplayManager.java:70)
at manager.DisplayManager.start(DisplayManager.java:50)
at Main.main(Main.java:22)
Traceback (most recent call last):
File "/home/boom/anaconda3/envs/th/lib/python3.7/site-packages/py4j/java_gateway.py", line 982, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/boom/anaconda3/envs/th/lib/python3.7/site-packages/py4j/java_gateway.py", line 1120, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "Gym-FightingICE/gymexe.py", line 10, in
obs = env.reset()
File "/home/boom/FTG4.50/Gym-FightingICE/gym_fightingice/envs/my_env.py", line 180, in reset
self._start_gateway(p2)
File "/home/boom/FTG4.50/Gym-FightingICE/gym_fightingice/envs/my_env.py", line 132, in _start_gateway
self.gateway.java_gateway_server.getCallbackClient().getAddress(), python_port)
File "/home/boom/anaconda3/envs/th/lib/python3.7/site-packages/py4j/java_gateway.py", line 1308, in call
answer = self.gateway_client.send_command(command)
File "/home/boom/anaconda3/envs/th/lib/python3.7/site-packages/py4j/java_gateway.py", line 1036, in send_command
connection = self._get_connection()
File "/home/boom/anaconda3/envs/th/lib/python3.7/site-packages/py4j/java_gateway.py", line 984, in _get_connection
connection = self._create_connection()
File "/home/boom/anaconda3/envs/th/lib/python3.7/site-packages/py4j/java_gateway.py", line 990, in _create_connection
connection.start()
File "/home/boom/anaconda3/envs/th/lib/python3.7/site-packages/py4j/java_gateway.py", line 1132, in start
raise Py4JNetworkError(msg, e)
py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:4242)
^CException ignored in: <module 'threading' from '/home/boom/anaconda3/envs/th/lib/python3.7/threading.py'>
Traceback (most recent call last):
File "/home/boom/anaconda3/envs/th/lib/python3.7/threading.py", line 1307, in _shutdown
lock.acquire()

Any suggestions about this problem?

The problem has been solved by using the tool 'Xvfb'.