tphakala / birdnet-go

Realtime BirdNET soundscape analyzer
Other
189 stars 19 forks source link

Pulseaudio 100% CPU #173

Closed Shellfishgene closed 3 weeks ago

Shellfishgene commented 5 months ago

Hi! I'm currently running birdnet-go on a Debian VM under Proxmox. Nothing apart from birdnet-go is running or installed. After a week or so the CPU goes to 100% usage and the VM barely responds anymore. The culprit seems to be pulseaudio, alternating /bin/pulseaudio and /bin/speech-dispatcher use all available CPU. Birdnet-go shows an error 'ring buffer full'. (And stuff about slow database, which is to be expected I guess.) Is this a Birdnet issue or something with Pulseaudio/Debian?

tphakala commented 5 months ago

Difficult to say without more details, however 'ring buffer full' would indicate that something failed within BirdNET-Go.

I just released a new version, can you please update to that and use ALSA source instead of PulseAudio source? ALSA is recommeded audio source for time being, you can just uninstall pulseaudio unless you are using it for anything else.

Shellfishgene commented 5 months ago

Thanks, will try the new version.

Shellfishgene commented 3 months ago

I removed PulseAudio now, and updated to the current release 0.5.5, and run realtime with -j 1, but the CPU goes to 100% right away with only birdnet-go processes using any. It's a Intel Celeron G4900, one CPU core from Proxmox in a Debian VM. While that's not the greatest CPU it should suffice no?

isZumpo commented 3 months ago

Maybe you end up with lots of expensive context switching using a single cpu core? Since birdnet has to share cpu time with all other os activities. Even more since it is all running inside a vm. Can you try increasing the cpu core count to two as an experiment?

Shellfishgene commented 3 months ago

I did that now, after I restart the VM the problem always goes away and only returns after a few days or so. So for now it's back at ~8% CPU. We'll see how it goes.

isZumpo commented 3 months ago

Ok let see what happens over the next few days. Here is a screenshot of cpu usage for my birdnet container over a few days. It should be quite stable:

Screenshot_20240726-160018.png

nicholasmparker commented 1 month ago

FWIW im getting a ton of "ringbuffer is full" in the logs. latest version via docker

tphakala commented 1 month ago

@nicholasmparker can you please provide

Thank you

tphakala commented 1 month ago

@nicholasmparker can you please test with latest docker image? I have increased ring buffer size and added some additional logging in case error happens. Problem is that I am unable to reproduce this issue myself.

nicholasmparker commented 1 month ago

Running it now. I will let you know!

On Fri, Sep 27, 2024 at 10:37 AM Tomi P. Hakala @.***> wrote:

@nicholasmparker https://github.com/nicholasmparker can you please test with latest docker image? I have increased ring buffer size and added some additional logging in case error happens. Problem is that I am unable to reproduce this issue myself.

— Reply to this email directly, view it on GitHub https://github.com/tphakala/birdnet-go/issues/173#issuecomment-2379564711, or unsubscribe https://github.com/notifications/unsubscribe-auth/AITIPCINJQSSUOXRRJ7RD3TZYV3TPAVCNFSM6AAAAABIEJGEDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZZGU3DINZRGE . You are receiving this because you were mentioned.Message ID: @.***>

tphakala commented 3 weeks ago

Closing this issue for now. If any ring buffer-related issues still occur, I encourage you to open a new issue