Main Content

Troubleshooting Running Out of File Descriptor Issues

Description

File descriptor running out warning or error messages (for example, WARN [load_mon] <pthread> low on FDs! (1 FDs left)) in the PX4 Console might cause undesirable behaviors.

Background

File descriptors are used to open and store uORB message handles, device driver handles and so on. By default, the number of File descriptors is limited to 12. PX4® runs out of file descriptors when large number of uORB Read / Write blocks or any other device driver blocks are added.

When PX4 runs out of File descriptors, the serial port opening is also handled using a file descriptor, thus Monitor and Tune simulation (external mode) connection might also fail.

Workaround

Increase number of File Descriptors by performing these steps.

For the CMake config you are using, go to the corresponding nuttx config folder. For example, for fmu-v5 go to Firmware\boards\px4\fmu-v5\nuttx-config\nsh

  1. Open the defconfig file.

  2. Modify the property CONFIG_NFILE_DESCRIPTORS to the desired number (for example, 20).

  3. Build the complete PX4 Firmware by navigating through the Hardware Setup screens. You can initiate the hardware setup process by opening the Add-On Manager.

    In the Add-On Manager, start the hardware setup process by clicking icon.

  4. Try building and deploying / running Monitor and Tune Simulation ( external mode) from Simulink®.