ovh / beamium

Prometheus to Warp10 metrics forwarder
Other
84 stars 21 forks source link

100% cpu usage on freebsd #130

Open knz opened 4 years ago

knz commented 4 years ago

Just installed from source since the OVH freebsd pkg archive doesn't deliver Freebsd 12 binaries yet.

The beamium binary is using 100% CPU.

Debugger reveals that the main loop in main.rs never sleeps: let watch_event_count = watcher_rx.try_iter().count(); completes immediately if there are no events, and the rest of the loop body doesn't do anything when there are no events.

Hence the busy-loop.

Adding a thread::sleep at the end of that loop seems to alleviate the issue.

GregOriol commented 3 years ago

Not sure it is the same, but we also have a case of one instance running at 100% CPU on ubuntu 20.04, but in our case we found out it was because the folder /opt/beamium/sources/ had a huge number of files (>200'000); we deleted all them, restarted beamium and it seems to be back to normal

knz commented 3 years ago

No Greg that is a different issue. Your issue is because of a large number of files causing a lot of stat() operations. The issue above is a bug in the source code which causes a busy loop doing absolutely nothing other than eating up CPU.