Skip to content

pysc2.lib.remote_controller.ConnectError: Connection rejected. Is something else connected? #365

@SacuraA

Description

@SacuraA

thank you for this awesome work!
but i received error when it runs to about 500000 steps:

Traceback (most recent call last):
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/smac/env/starcraft2/starcraft2.py", line 477, in step
self._controller.actions(req_actions)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/lib/remote_controller.py", line 81, in _skip_status
return func(self, *args, **kwargs)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/lib/remote_controller.py", line 92, in _valid_status
raise protocol.ProtocolError(
pysc2.lib.protocol.ProtocolError: actions called while in state: Status.ended, valid: (Status.in_game)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/lib/remote_controller.py", line 165, in _connect
return websocket.create_connection(url, timeout=timeout_seconds)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/websocket/_core.py", line 608, in create_connection
websock.connect(url, **options)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/websocket/_core.py", line 253, in connect
self.handshake_response = handshake(self.sock, url, *addrs, **options)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/websocket/_handshake.py", line 57, in handshake
status, resp = _get_resp_headers(sock)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/websocket/_handshake.py", line 145, in _get_resp_headers
status, resp_headers, status_message = read_headers(sock)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/websocket/_http.py", line 312, in read_headers
line = recv_line(sock)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/websocket/_socket.py", line 131, in recv_line
c = recv(sock, 1)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/websocket/_socket.py", line 122, in recv
raise WebSocketConnectionClosedException(
websocket._exceptions.WebSocketConnectionClosedException: Connection to remote host was lost.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ryan/ACORM/./ACORM_QMIX/main.py", line 67, in
runner.run()
File "/home/ryan/ACORM/ACORM_QMIX/run.py", line 62, in run
_, _, episode_steps = self.run_episode_smac(evaluate=False) # Run an episode
File "/home/ryan/ACORM/ACORM_QMIX/run.py", line 144, in run_episode_smac
r, done, info = self.env.step(a_n) # Take a step
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/smac/env/starcraft2/starcraft2.py", line 483, in step
self.full_restart()
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/smac/env/starcraft2/starcraft2.py", line 449, in full_restart
self._launch()
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/smac/env/starcraft2/starcraft2.py", line 323, in _launch
self._sc2_proc = self._run_config.start(
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/run_configs/platforms.py", line 200, in start
return super(Linux, self).start(
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/run_configs/platforms.py", line 83, in start
return sc_process.StarcraftProcess(
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/lib/sc_process.py", line 137, in init
self._controller = remote_controller.RemoteController(
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/lib/remote_controller.py", line 142, in init
sock = self._connect(host, port, proc, timeout_seconds)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/lib/stopwatch.py", line 205, in _stopwatch
return func(*args, **kwargs)
File "/home/ryan/anaconda3/envs/acorm/lib/python3.9/site-packages/pysc2/lib/remote_controller.py", line 169, in _connect
raise ConnectError("Connection rejected. Is something else connected?")
pysc2.lib.remote_controller.ConnectError: Connection rejected. Is something else connected?

I've got this error for several times ,how to solve this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions