Overrun when using arecord for extended periods

ewanr

New Member
Credits
33
I have built a radio streamer/recorder with Node.js (repo here). This program will need to stream/record audio input 24/7, but I am having trouble running it for extended periods (see issue).

I use the node "mic" package to stream from my audio input with arecord; and after some debugging, I have found this to be the culprit. Consistently, after 9-10 hours, arecord reports the following error:
Received Info: overrun!!! (at least 33356345.350 ms long)
(See issue).

I have tried running arecord with the same command used by the node package, arecord -t raw -c 2 -r 44100 -f S16_LE -D hw:0,0 /recordings/test.raw, and it streamed for over 100 hours with no errors. So I'm wondering what "mic" does that causes arecord to report this error, and what I can do, if anything, to prevent it.
 


sp331yi

Well-Known Member
Credits
3,633
Those who know more than I suggest that free space is too little; a larger drive or taking some recordings off of hdd onto DVD may help.
 

ewanr

New Member
Credits
33
Those who know more than I suggest that free space is too little; a larger drive or taking some recordings off of hdd onto DVD may help.
I doubt it's a space issue, there is more than enough space on the hard drive (> 400 GB). As I say, it managed to record over 100 hours of raw audio (60 GB) and there is still 85% of the HDD space free. I made sure to calculate how much I can record, and the program will delete recordings older than 30 days, so this should not be an issue. Besides this, the streaming element of the program does not need to use any disk space as it is simply sending the data to an Icecast server.

My understanding of the "mic" library is that arecord is just piping the stream to node. My program then encodes it to MP3 and streams/saves the output. As far as arecord is concerned, it hasn't actually saved anything to disk; yet it is arecord that reports the error, not my program.
 

sp331yi

Well-Known Member
Credits
3,633
As far as arecord is concerned, it hasn't actually saved anything to disk; yet it is arecord that reports the error, not my program.
RAM? Or maybe creating a swapfile? It seems arecord is running out of space somewhere.
 

JasKinasis

Well-Known Member
Credits
1,193
From a quick bit of duckduckgo-fu - This is a known issue with arecord. I've found several mentions of this problem. This is just one of them, but it's in an alsa mailing list on sourceforge, so it's probably the most relevant I can find:

It's to do with arecord having trouble accessing resources.
It doesn't appear to be a memory leak in arecord, or a defect in the way arecord is coded. It seems to be related to other processes that are running. It seems that this error is thrown if arecord cannot access the resources it needs.

In my opinion, it’s most likely to be another process that is writing to disk and preventing arecord from writing its buffer to disk. It only needs to block arecord for a very short time, in order to cause a problem. It seems like it's periodically unable to empty the buffer to disk before it runs out of space and is exceeded.

Some people reporting this error are getting it after as little as 10 minutes, others get it after several hours of recording. So to be getting 100 hours or so out of it isn't bad going.

The linked thread mentions prioritising audio over other applications.
I'm not sure if installing a real-time kernel patch will also help. I know the real-time patch helps to get low latency recordings when using DAW software like Ardour and other JACK applications.

Also the OP in the linked thread says that he fixed his application by swapping arecord for sox (aka SOund eXchange - which claims to be the audio swiss-army knife). So if arecord is problematic, perhaps try sox?
 
Last edited:

ewanr

New Member
Credits
33
I have tried using SoX, but this does not remove the overrun issue, as it is just wrapping ALSA.
I get the following error after about 10 hours:
Code:
In:0.00% 10:40:56.15 [00:00:00.00] Out:1.70G [  ====|===-  ]        Clip:0    rec WARN alsa: over-run
 


Members online


Top