Bug #53747
openCeph subprocess calling calls close() 1 million times
0%
Description
When you run a command that spawns an external program, like `ceph device scrape-health-metrics`, Ceph calls the `close()` syscall 1 million times, as evidenced by strace:
[pid 62944] close(987786) = -1 EBADF (Bad file descriptor)
[pid 62944] close(987787) = -1 EBADF (Bad file descriptor)
This is slow, and makes stracing for debugging a pain.
Today are now more efficient ways to close file descriptors before exec()ing:
1. `O_CLOEXEC` when opening any file. Some ecosystems, like Python, use this throughout. This is the most efficient.
2. The close_range() system call, introduced with Linux 5.9: https://man7.org/linux/man-pages/man2/close_range.2.html - Motivation: https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.9-Close-Range
Updated by Guillaume Abrioux about 2 years ago
- Project changed from ceph-volume to mgr