[Help Request] TraCI could not connect
DOPEMANdd opened this issue · comments
DOPEMANdd commented
High Level Description
Traceback (most recent call last):
File "train_ppo.py", line 81, in <module>
state, dones = env.reset(), {"__all__": False}
File "/data/zhangdi/anaconda3/envs/smart/lib/python3.8/site-packages/gymnasium/wrappers/order_enforcing.py", line 61, in reset
return self.env.reset(**kwargs)
File "/data/zhangdi/anaconda3/envs/smart/lib/python3.8/site-packages/gymnasium/core.py", line 453, in reset
return self.env.reset(seed=seed, options=options)
File "/data/zhangdi/smart_master/SMARTS/smarts/env/gymnasium/hiway_env_v1.py", line 348, in reset
observations = self._smarts.reset(
File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 471, in reset
raise first_exception
File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 464, in reset
return self._reset(scenario, start_time)
File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 501, in _reset
self.setup(scenario)
File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 539, in setup
provider_state = self._setup_providers(self._scenario)
File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 1230, in _setup_providers
new_provider_state = self._handle_provider(provider, provider_error)
File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 1265, in _handle_provider
provider_state, recovered = provider.recover(
File "/data/zhangdi/smart_master/SMARTS/smarts/core/sumo_traffic_simulation.py", line 462, in recover
raise error
File "/data/zhangdi/smart_master/SMARTS/smarts/core/smarts.py", line 1228, in _setup_providers
new_provider_state = provider.setup(scenario)
File "/data/zhangdi/smart_master/SMARTS/smarts/core/sumo_traffic_simulation.py", line 324, in setup
self._initialize_traci_conn()
File "/data/zhangdi/smart_master/SMARTS/smarts/core/sumo_traffic_simulation.py", line 239, in _initialize_traci_conn
self._traci_conn.setOrder(0)
TypeError: 'NoneType' object is not callable
Exception ignored in: <function SafeBulletClient.__del__ at 0x7fd4b995cd30>
Traceback (most recent call last):
File "/data/zhangdi/smart_master/SMARTS/smarts/core/utils/pybullet.py", line 52, in __del__
File "/data/zhangdi/anaconda3/envs/smart/lib/python3.8/site-packages/pybullet_utils/bullet_client.py", line 43, in __del__
TypeError: catching classes that do not inherit from BaseException is not allowed
Version
v1.4.0
Operating System
No response
Problems
No response
Tucker Alban commented
Hello @DOPEMANdd, thank you for the report. Would you happen to have used the `python -O` optimization flag?
I think we made a bad assumption that the assert would always be there to prevent other exceptions.
https://github.com/huawei-noah/SMARTS/blob/55187d066a2ff5c3e60abddc27a1ef13399cb6aa/smarts/core/sumo_traffic_simulation.py#L236-L241
I will put out a patch for it.
Tucker Alban commented
Hello @DOPEMANdd, some progress. I have been looking deeper into the errors provided.
Error 1
I need a bit more information to address this bug.
File "/data/zhangdi/smart_master/SMARTS/smarts/core/sumo_traffic_simulation.py", line 239, in _initialize_traci_conn
self._traci_conn.setOrder(0)
TypeError: 'NoneType' object is not callable
Current patch
- SMARTS will terminate with a better description if the
TraCI
orSUMO
versions are incompatible. engine.ini
now allows configuration of how many times to retry theTraCI
connection.- The
[traffic] traci_retries
.ini
configuration orSMARTS_TRAFFIC_TRACI_RETRIES
environment variable can be configured for more connection attempts if necessary.
- The
- If SMARTS cannot acquire a TraCI server it will be clear about it.
Error 2
I have included changes in this patch to make this error go away.
Exception ignored in: <function SafeBulletClient.del at 0x7fd4b995cd30>
Traceback (most recent call last):
File "/data/zhangdi/smart_master/SMARTS/smarts/core/utils/pybullet.py", line 52, in del
File "/data/zhangdi/anaconda3/envs/smart/lib/python3.8/site-packages/pybullet_utils/bullet_client.py", line 43, in del
TypeError: catching classes that do not inherit from BaseException is not allowed
Current patch
SafeBulletClient.__del__()
now wraps theBulletClient.__del__()
to prevent the bad error handling from escaping the method call.