Volumio v1.55 @ RPI - upmpdcli stops working

Hi,

first of all, I would like to thank all developers and contributers of the Volumio project: you’re doing great job :slight_smile:.

I have two RPI’s (first model), both witch Volumio installed, DLNA enabled. I use BubbleUPNP on 3 Android smartphones to control both Volumios.

From time to times, the Volumio device doesn’t show up anymore in BubbleUPNP. I need te restart the RPI after which it reappears. Knowing this, I changed player_wrk.php to enable logging for upnpmpdcli:

[code]root@(none):/var/www/command# less player_wrk.php

// Mpdupnpcli for UPNP control
if (isset($_SESSION[‘upnpmpdcli’]) && $_SESSION[‘upnpmpdcli’] == 1) {
$cmd = ‘/usr/bin/upmpdcli -f "’.$hostname.’" -l 4 -d /var/log/upmpdcli > /dev/null 2>&1 &’;
sysCmd($cmd);
}
[/code]

After a while (most of the times takes less than some days) the device doesn’t show up anymore. When I investigate my logs I see:

root@(none):/var/www/command# ls -la /var/log/upmpdcli
-rw-r--r-- 1 upmpdcli root 22081674 Apr 12 05:26 /var/log/upmpdcli
 
 ...
 
upmpd/ohtime.cxx:104::OHTime::ohtime
libupnpp/device/device.cxx:197::UPNP_CONTROL_ACTION_REQUEST: Time. Params: <?xml version="1.0"?>
<u:Time xmlns:u="urn:av-openhome-org:service:Time:1"></u:Time>
 
upmpd/ohtime.cxx:104::OHTime::ohtime
libupnpp/device/device.cxx:197::UPNP_CONTROL_ACTION_REQUEST: Stop. Params: <?xml version="1.0"?>
<u:Stop xmlns:u="urn:av-openhome-org:service:Playlist:1"></u:Stop>
 
upmpd/ohplaylist.cxx:289::OHPlaylist::stop
upmpd/mpdcli.cxx:357::MPDCli::stop
libupnpp/device/device.cxx:377::UpnpDevice:eventloop: wait errno 115
upmpd/upmpd.cxx:512::Event loop returned
upmpd/ohmetacache.cxx:114::dmcacheSaveWorker: can't get task from queue

When I restart the Volumio (or manually restart upmpdcli through command line), the Volumio reappears.

Although this seems to be a bug in upmpdcli, I would like to know if you have any clues on this issue. If not, I might post this question in the upmpdcli forum.

I managed to create a workaround which satisfies my needs. In the worker loop of player_wrk.php, I added a process monitor which monitors the upmpdcli process. It just restarts the process if it is not running anymore. The loop is scheduled to run every 7 seconds. Note: this workaround doesn’t solve the original bug, but as I mentioned, this is a workaround which works OK for me.

...
// --- WORKER MAIN LOOP --- //
while (1) {
sleep(7);
session_start();
	// check if some components are still running

	// Mpdupnpcli for UPNP control
	if (isset($_SESSION['upnpmpdcli']) && $_SESSION['upnpmpdcli'] == 1) {
		if (count(sysCmd('pidof upmpdcli')) == 0) {
			$now = date("Y/m/d H:i:s");
			$cmd = 'echo "Restarting upmpdcli at: '.$now.'" >> /var/log/volumio_monitor.log';
			sysCmd($cmd);

			$cmd = '/usr/bin/upmpdcli -f "'.$hostname.'" -l 0 > /dev/null 2>&1 &';
			sysCmd($cmd);
		}
	}

	// monitor loop
	if ($_SESSION['w_active'] == 1 && $_SESSION['w_lock'] == 0) {
	$_SESSION['w_lock'] = 1;
...