carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
10.83k stars 3.48k forks source link

Uncatchable carla::client::TimeoutException on simulator crash #4577

Open AreopagX opened 2 years ago

AreopagX commented 2 years ago

CARLA version: 0.9.12 Platform/OS: Ubuntu 20.04 Problem you have experienced: terminate called after throwing an instance of 'carla::client::TimeoutException' what(): time-out of 60000ms while waiting for the simulator, make sure the simulator is ready and connected to localhost:2000 Aborted (core dumped)

What you expected to happen: I expected a RuntimeException to be thrown and caught by a try-except clause covering the main function.

Steps to reproduce:

Run the code from the following file twice (it's a .txt file because GitHub won't allow uploading .py files). test.txt

Caught exception! Traceback (most recent call last): File "test.py", line 18, in main world = client.get_world() RuntimeError: time-out of 10000ms while waiting for the simulator, make sure the simulator is ready and connected to localhost:2000

I'd like to be able to restart the CARLA simulator when it crashes due to whatever reason by catching the timeout exception in order to run the simulation for some hours without the need for human supervision.

hh0rva1h commented 2 years ago

Please label this as a bug / feature request. The culprit of this is traffic manager. As soon as traffic manager is initiated (which you do by setting the autopilot), there seems to be no way to terminate traffic manager in the API. This should be changed for exactly the reason mentioned in this report: Sometimes Carla crashes and one would like to catch that exception and handle a restart of Carla.

There are various requests spread across many different reports asking exactly for that:

As a consequence people are forced to complicated multiprocessing workarounds, see for example:

For me no workaround is possible, as running traffic manager in a separate process is not really possible in synchronous mode, since the client that ticks needs to hold traffic manager.

@bernatx @bernatx Please make this a high priority issue.

hh0rva1h commented 2 years ago

@bernatx Would be amazing if you could give your opinion here.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

hh0rva1h commented 2 years ago

@bernatx Please provide some input here: would someone of the team be interested to improve this? If not then please directly close this, but it leaves a bad taste in user's mouths to let stale bot mass close issues without any dev input.

MoritzNekolla commented 1 year ago

@bernatx Please provide some input here: would someone of the team be interested to improve this? If not then please directly close this, but it leaves a bad taste in user's mouths to let stale bot mass close issues without any dev input.

+1

Recoan0 commented 1 year ago

I am also running into this issue, is there any update on this/fix that doesn't involve creating extra sub-processes?

OOOllie commented 2 weeks ago

I am also having this issue, it is not possible for me to multiprocess it due to the nature of my application and communication to that process