# [costmap_2d] Failed to update costmap layer 'obstacle_layer': buffer overflow in mark function

- **ID:** `ros2/nav2-costmap-layer-buffer-overflow`
- **Domain:** ros2
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The obstacle layer's internal buffer for marking obstacles overflows when too many points are added in a single update cycle, often due to a high-rate sensor publishing an excessive number of points.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ros2-humble | active | — | — |
| ros2-iron | active | — | — |
| ros2-rolling | active | — | — |

## Workarounds

1. **Reduce the sensor's point cloud publish rate: in the sensor driver configuration, set 'publish_rate: 5.0' (Hz) or use a filter like 'voxel_grid' to downsample.** (85% success)
   ```
   Reduce the sensor's point cloud publish rate: in the sensor driver configuration, set 'publish_rate: 5.0' (Hz) or use a filter like 'voxel_grid' to downsample.
   ```
2. **Increase the costmap update frequency and decrease the obstacle layer's 'combination_method' to '1' (max) to reduce buffer usage: set 'update_frequency: 10.0' and 'obstacle_layer.combination_method: 1' in costmap_common_params.yaml.** (80% success)
   ```
   Increase the costmap update frequency and decrease the obstacle layer's 'combination_method' to '1' (max) to reduce buffer usage: set 'update_frequency: 10.0' and 'obstacle_layer.combination_method: 1' in costmap_common_params.yaml.
   ```

## Dead Ends

- **** — Buffer overflow is a symptom of excessive data rate; increasing buffer may delay overflow but not prevent it. (50% fail)
- **** — Disabling obstacle layer removes obstacle avoidance, making navigation unsafe. (30% fail)
