Environment
The following has been tested in Ubuntu with Carla 0.9.9.4, started using
1
| CarlaUE4.sh -opengl -quality-level=Low |
:
Trigger Code
Consider the following proof of concept code (does not logically make a lot of sense, since it was stripped down from an old version of our reinforcement learning infrastructure to be a minimal reproducer that makes Carla misbehave and crash reliably):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| py
import carla
def update_data(self, data):
self.data = data
def spawn_and_destroy():
client = carla.Client("localhost", 2000)
client.set_timeout(3)
world = client.load_world("Town04")
blueprints = world.get_blueprint_library()
settings = world.get_settings()
settings.fixed_delta_seconds = 0.05
settings.synchronous_mode = True
settings.no_rendering_mode = True
world.apply_settings(settings)
car = blueprints.find("vehicle.tesla.model3")
position = carla.Transform(carla.Location(x=300, y=13.5, z=2), carla.Rotation(yaw=180))
vehicle = world.spawn_actor(car, position)
collision_actor = world.spawn_actor(blueprints.find("sensor.other.collision"),
carla.Transform(carla.Location()),
attach_to=vehicle)
collision_actor.listen(update_data)
lane_actor = world.spawn_actor(blueprints.find("sensor.other.lane_invasion"),
carla.Transform(), # carla.Location()),
attach_to=vehicle)
vehicle.apply_control(carla.VehicleControl(hand_brake=1))
lane_actor.listen(update_data)
for i in range(10):
try:
world.tick(1)
except:
print("WARNING: tick timed out, continuing ...")
vehicle.destroy()
collision_actor.destroy()
lane_actor.destroy()
for i in range(150):
print("Episode", i)
spawn_and_destroy() |
Starting Carla and then executing this file reliably produces problems within 127 Episodes here, though the behavior is not always exactly the same, see the following sections.
Crash variant 1
After 127 Episodes the script ends:
1 2 3 4 5 6 7 8
| Episode 127
Traceback (most recent call last):
File "carla-segfault-min.py", line 87, in
spawn_and_destroy()
File "carla-segfault-min.py", line 51, in spawn_and_destroy
client = carla.Client("localhost", 2000)
RuntimeError: resolve: Device or resource busy
|
and Carla crashes with the following message:
1 2 3 4 5 6 7 8 9
| 4.24.3-0+++UE4+Release-4.24 518 0
Disabling core dumps.
Signal 11 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554
CommonUnixCrashHandler: Signal=11
Malloc Size=65535 LargeMemoryPoolOffset=131119
Malloc Size=140864 LargeMemoryPoolOffset=272000
Engine crash handling finished; re-raising signal 11 for the default handler. Good bye.
Segmentation fault (core dumped) |
1 2
| ### Crash variant 2
After Episode 127 the script stops: |
Episode 127
Traceback (most recent call last):
File "carla-segfault-min.py", line 55, in
spawn_and_destroy()
File "carla-segfault-min.py", line 19, in spawn_and_destroy
client = carla.Client("localhost", 2000)
RuntimeError: resolve: Device or resource busy
1
| and Carla crashes with the following message: |
4.24.3-0+++UE4+Release-4.24 518 0
Disabling core dumps.
LowLevelFatalError [File:Unknown] [Line: 102]
Exception thrown: close: Bad file descriptor
Signal 11 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554
CommonUnixCrashHandler: Signal=11
Malloc Size=65535 LargeMemoryPoolOffset=131119
Malloc Size=140864 LargeMemoryPoolOffset=272000
Engine crash handling finished; re-raising signal 11 for the default handler. Good bye.
Segmentation fault (core dumped)
1 2 3
| ### Crash variant 3
I tested the above script multiple times and at one occurrence Carla already crashed within 27 episodes: |
Episode 27
Traceback (most recent call last):
File "carla-segfault-min.py", line 87, in
spawn_and_destroy()
File "carla-segfault-min.py", line 53, in spawn_and_destroy
world = client.load_world("Town04")
RuntimeError: failed to connect to newly created map
1
| with the following crash message: |
4.24.3-0+++UE4+Release-4.24 518 0
Disabling core dumps.
Signal 11 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554
terminating with uncaught exception of type std::__1::bad_weak_ptr: bad_weak_ptrCommonUnixCrashHandler: Signal=11
Signal 6 caught.
Malloc Size=65535 LargeMemoryPoolOffset=131119
Malloc Size=140864 LargeMemoryPoolOffset=272000
Engine crash handling finished; re-raising signal 11 for the default handler. Good bye.
Segmentation fault (core dumped)
Episode 38
Traceback (most recent call last):
File "carla-segfault-min.py", line 55, in
spawn_and_destroy()
File "carla-segfault-min.py", line 21, in spawn_and_destroy
world = client.load_world("Town04")
RuntimeError: failed to connect to newly created map
4.24.3-0+++UE4+Release-4.24 518 0
Disabling core dumps.
Signal 11 caught.
Malloc Size=65538 LargeMemoryPoolOffset=65554
CommonUnixCrashHandler: Signal=11
Malloc Size=65535 LargeMemoryPoolOffset=131119
Malloc Size=140864 LargeMemoryPoolOffset=272000
Engine crash handling finished; re-raising signal 11 for the default handler. Good bye.
Segmentation fault (core dumped)
```
该提问来源于开源项目:carla-simulator/carla
Our tests suggested that the only issue is the reloading of the map, so we just do not reload it, we just reset our scenarios in the current world. I do not know however if that is feasible for you!