AllStarLink / app_rpt

Refactoring and upgrade of AllStarLink's app_rpt, etc.
8 stars 6 forks source link

app_rpt: outstreamcmd does not work #199

Closed KB4MDD closed 1 year ago

KB4MDD commented 1 year ago

I was attempting to convert a RPI node to ASL3 and discovered a problem with outstreamcmd. When the node starts, I see the following messages continuously repeating.

[2023-07-24 03:48:55.562]     -- app_rpt node 53431 starting output stream /bin/sh,-c,/usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - - | /usr/bin/ezstream -qvc /etc/ezstream.xml
[2023-07-24 03:48:55.813]     -- app_rpt node 53431 starting output stream /bin/sh,-c,/usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - - | /usr/bin/ezstream -qvc /etc/ezstream.xml
[2023-07-24 03:48:55.864]     -- app_rpt node 53431 starting output stream /bin/sh,-c,/usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - - | /usr/bin/ezstream -qvc /etc/ezstream.xml

That is ultimately followed by.

[2023-07-24 13:01:55.439] ERROR[1310]: app_rpt.c:1071 startoutstream: pipe() failed!
[2023-07-24 13:01:55.439] WARNING[1318]: app_rpt.c:5577 rpt: write failed: Broken pipe
[2023-07-24 13:01:55.459] WARNING[1318]: app_rpt.c:5577 rpt: write failed: Broken pipe

I verified that ezstream was installed.

InterLinked1 commented 1 year ago

Can you change line 1071 of app_rpt.c: https://github.com/InterLinked1/app_rpt/blob/master/apps/app_rpt.c#L1071

ast_log(LOG_ERROR, "pipe() failed!\n");

to

ast_log(LOG_ERROR, "pipe() failed: %s\n", strerror(errno));

I'm not at home right now, or I'd make those changes myself and push an updated version, but you can just make that locally for now to see the error message.

I'm guessing the error might be "too many file descriptors in use" or something along those lines. If so, you'd need to raise the max # of fds allowed using ulimit. You could also verify in /proc how many file descriptors are in use when this happens.

KB4MDD commented 1 year ago

I did not have lame installed. It is now starting the background process, but apparently there is some other issue. The process, I think, is stopping and app_rpt is restarting it. The could be a setup issue. I will test further.

KB4MDD commented 1 year ago

There continues to be an issue with outstream. It is unknow if the problem is associated with app_rpt, the way it runs the external process or the commands that are being run.

I am using this command:

outstreamcmd = /bin/sh,-c,/usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - - | /usr/bin/ezstream -qvc /etc/ezstream.xml

On a working system I see these processes:

root     15638 19785  0 Jul25 ?        00:00:00 /bin/sh -c /usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16
root     15639 15638  1 Jul25 ?        00:12:11 /usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - -
root     15640 15638  0 Jul25 ?        00:00:12 /usr/bin/ezstream -qvc /etc/ezstream.xml

On ASL3, I see these processes:

root     15638 19785  0 Jul25 ?        00:00:00 /bin/sh -c /usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16
root     15639 15638  1 Jul25 ?        00:12:11 /usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - -

The old system information:

Raspbian GNU/Linux 9 (stretch) lame version 3.99.5 ezstream version 0.5.6

ALS3 system: Debian GNU/Linux 11 (bullseye) lame version 3.100 ezstream version 1.0.2

KB4MDD commented 1 year ago

Updating with results with this command:

outstreamcmd = /bin/sh,-c,/usr/bin/lame --preset cbr 16 -r -m m -s 8 --bitwidth 16 - - 2> /tmp/lamestatus.log | /usr/bin/ezstream -vvvc /etc/ezstream.xml 2>/tmp/ezstreamstatus.log

lamestatus.log

WARNING: libsndfile may ignore -r and perform fseek's on the input.
Compile without libsndfile if this is a problem.
Assuming raw pcm input file
LAME 3.100 32bits (http://lame.sf.net)
polyphase lowpass filter disabled
Encoding <stdin> to <stdout>
Encoding as 8 kHz single-ch MPEG-2.5 Layer III (8x)  16 kbps qval=3

ezstreamstatus.log

/usr/bin/ezstream: 1: cat:: not found
/usr/bin/ezstream: 2: Try: not found
KB4MDD commented 1 year ago

I think something is wrong with ezstream.

Old system running command ezstream -qvc /etc/ezstream.xml

ezstream -qvc /etc/ezstream.xml
ezstream: Warning: /etc/ezstream.xml is group and/or world readable
ezstream: Connection to http://audio1.broadcastify.com:80/56gx8smdtn7c failed: Login failed
ezstream: Exiting ...

ALS3 with the same command

root@k4ywe:/etc# ezstream -qvc /etc/ezstream.xml
/usr/bin/ezstream: line 1: cat:: command not found
/usr/bin/ezstream: line 2: Try: command not found
InterLinked1 commented 1 year ago

Is exstream a binary program? It almost seems like a script by the output. Could you post the program contents?

KB4MDD commented 1 year ago

Yes - so there was a problem with the install or something that I did. I reinstalled. Now I have something to work with.

root@k4ywe:/etc# ezstream -qvc /etc/ezstream.xml
ezstream[2798]: stream: default: format: MP3: This libshout doesn't support the 

Ezstream is broken. I am going to see if I can install the same version that is on my working system.

KB4MDD commented 1 year ago

The error above is a known problem to the developers. It has been fixed in the devel branch and would require compiling from source.

I managed to get the old version from my other RPI. I will be testing this on hardware later this week.

I will note that when the new version is fixed and installed, the configuration file format has changed. The old xml file format will not work.

KB4MDD commented 1 year ago

I am closing this issue. Documentation on setting up Broadcastify is available at https://github.com/AllStarLink/ASL3/blob/develop/Broadcastify_Setup.md