Linux read() occasionally returns “No child processes” (errno 10) when reading perf counters after kernel update
I have C++ program that collects hardware counters using the perf_event_open and read methods on CentOS9 Stream.
The code was working perfectly fine with kernel version 5.14.0-319.el9.x86_64. After a kernel update to 5.14.0-472.el9.x86_64, the read method occasionally returns -1. I haven’t been able to find the cause, it seems random when it happens. Sometimes I’m able to collect hundreds of samples before I encounter this error, and other times only 20 or so. Sometimes the program runs error free.