Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: Web interface hangs after being idle
#1
Hi,

I'm a new user and set up a Pi Zero 2W and am having issues where if I leave it running for a while the web interface will stop responding and I'll get a 502 gateway error.

I traced this down and found that PHP FPM was logging the following


Code:
WARNING: [pool www] server reached pm.max_children setting (64), consider raising it


Further investigation found requests to `/engine-mpd.php` were taking upwards of 5 minutes. It did eventually return with the following, but took 5.9 minutes to get there.



Code:
{"volume":"74","repeat":"0","random":"0","single":"0","consume":"0","partition":"default","playlist":"2","playlistlength":"31","mixrampdb":"0","state":"stop","lastloadedplaylist":"Default Playlist","song":"0","songid":"1","nextsong":"1","nextsongid":"2","elapsed":"","time":null,"song_percent":"0","audio_format":"PCM","audio_sample_rate":null,"audio_sample_depth":null,"audio_channels":"?Ch","bitrate":"0 bps","idle_timeout_event":"changed: subscription","file":"SDCARD\/Stereo Test\/LRMonoPhase4.flac","thumb_hash":"ef98c55fbb179b6c6571e8902ddc9534","genre":"Utilities","track":"1","date":"199700","composer":null,"conductor":null,"performer":null,"albumartist":"Koz","artist_count":1,"comment":null,"cover_art_hash":"505a63cec3dbf91e4e93887a26890927","mapped_db_vol":"","encoded":"FLAC 16\/48 kHz, 2ch","artist":"Koz","title":"LR Channel And Phase","album":"Stereo Test","disc":"Disc tag missing","coverurl":"\/coverart.php\/SDCARD%2FStereo%20Test%2FLRMonoPhase4.flac","hidef":"yes","output":"Not playing"}



As the web UI periodically calls this endpoint leaving it running for a bit eventually uses up the FPM pool.

I set it playing something from my library and it's now taking ~1.3 seconds to return, same when playing that sample track off the SD card.

I've tried 2 cards, so I don't think this is the issue. And the requests to MPD are over the loopback interface so I don't think this is networking related.

Any ideas?

This is the `moode.log` contents.


Code:
20250604 111754 worker: --
20250604 111754 worker: -- Start moOde 9 series
20250604 111754 worker: --
20250604 111754 worker: Daemonize:     complete
20250604 111755 worker: Linux startup: complete
20250604 111755 worker: Boot config:   ok
20250604 111755 worker: Boot folder:   ok
20250604 111755 worker: Radio table:   ok
20250604 111757 worker: PHP session:   cleaned
20250604 111757 worker: PHP session:   loaded
20250604 111807 worker: Package locks: applied
20250604 111808 worker: File check:    complete
20250604 111808 worker: Log to RAM:    on
20250604 111808 worker: Tmp to RAM:    on
20250604 111808 worker: Debug logging: off
20250604 111808 worker: --
20250604 111808 worker: -- System
20250604 111808 worker: --
20250604 111813 worker: Host name:     moode
20250604 111813 worker: RPi model:     Pi-Zero 2 W 1.0 512MB
20250604 111813 worker: moOde release: 9.3.5 2025-05-25
20250604 111813 worker: RaspiOS:       12.11 Bookworm 64-bit
20250604 111813 worker: Linux Kernel:  6.12.25 64-bit
20250604 111813 worker: MPD version:   0.24.4
20250604 111813 worker: User id:       ntorn
20250604 111813 worker: Home folder:   /home/ntorn
20250604 111813 worker: Time zone:     Europe/London
20250604 111813 worker: Kbd layout:    gb
20250604 111813 worker: HDMI ports(s): on
20250604 111813 worker: HDMI-CEC:      off
20250604 111814 worker: Sys LED0:      on
20250604 111814 worker: Sys LED1:      sysclass does not exist
20250604 111814 worker: Reduce power:  n/a
20250604 111814 worker: Fan control:   n/a
20250604 111814 worker: CPU governor:  ondemand
20250604 111814 worker: --
20250604 111814 worker: -- Network
20250604 111814 worker: --
20250604 111814 worker: Eth0
20250604 111814 worker: Ethernet: adapter does not exist
20250604 111814 worker: Wlan0
20250604 111814 worker: Wireless: adapter exists
20250604 111814 worker: Wireless: country US
20250604 111814 worker: Wireless: SSID    Home
20250604 111814 worker: Wireless: other   None
20250604 111814 worker: Wireless: timeout up to 90 secs
20250604 111814 worker: Wireless: connect to Home
20250604 111814 worker: Wireless: method  dhcp
20250604 111814 worker: Wireless: address 10.69.42.117
20250604 111814 worker: Wireless: netmask 255.255.240.0
20250604 111814 worker: Wireless: gateway 10.69.32.1
20250604 111814 worker: Wireless: pri DNS 10.69.32.1
20250604 111814 worker: Wireless: domain  none found
20250604 111814 worker: mDNS
20250604 111814 worker: Discover: IPv4 and IPv6
20250604 111814 worker: --
20250604 111814 worker: -- File sharing
20250604 111814 worker: --
20250604 111814 worker: SMB file sharing:  off
20250604 111814 worker: SMB password:      none
20250604 111814 worker: NFS file sharing:  off
20250604 111814 worker: DLNA file sharing: off
20250604 111814 worker: --
20250604 111814 worker: -- Special configs
20250604 111814 worker: --
20250604 111814 worker: Plexamp:          not installed
20250604 111814 worker: RoonBridge:       not installed
20250604 111814 worker: Allo Boss 2:      not detected, OLED script ok
20250604 111814 worker: Allo Piano 2.1:   not detected
20250604 111814 worker: IQaudIO DigiAMP+: not detected
20250604 111814 worker: RPi DigiAMP+:     not detected
20250604 111814 worker: Bluetooth:        session vars ok
20250604 111814 worker: --
20250604 111814 worker: -- ALSA debug
20250604 111814 worker: --
20250604 111814 worker: Cards:  0:sndrpihifiberry 1:vc4hdmi         2:empty           3:empty
20250604 111814 worker:         4:empty           5:empty           6:empty           7:empty
20250604 111815 worker: Mixers: 0:none            1:none            2:none            3:none
20250604 111815 worker:         4:none            5:none            6:none            7:none
20250604 111815 worker: --
20250604 111815 worker: -- Audio configuration
20250604 111815 worker: --
20250604 111815 worker: Audio device:  0:snd_rpi_hifiberry_dac
20250604 111815 worker: ALSA card:     has not been reassigned
20250604 111815 worker: MPD config:    update not needed
20250604 111909 worker: ALSA output:   USB
20250604 111909 worker: ALSA mode:     Default (plughw)
20250604 111909 worker: ALSA mixer:    none exists
20250604 111912 worker: ALSA volume:   controller not detected
20250604 111912 worker: ALSA maxvol:   100%
20250604 111912 worker: ALSA loopback: off
20250604 111912 worker: MPD mixer      Software
20250604 111912 worker: Integ audio:   vc4-kms-v3d
20250604 111912 worker: Audio formats: S16_LE, S24_LE, S32_LE
20250604 111913 worker: CamillaDSP:    off
20250604 111913 worker: CDSP volume:   0dB
20250604 111913 worker: CDSP volrange: 60dB
20250604 111913 worker: --
20250604 111913 worker: -- MPD startup
20250604 111913 worker: --
20250604 111914 worker: MPD service:        started
20250604 111914 worker: MPD port 6600:      accepting connections
20250604 111914 worker: MPD ALSA Default:   on
20250604 111914 worker: MPD ALSA Bluetooth: off
20250604 111914 worker: MPD HTTP Server:    off
20250604 111914 worker: MPD volume:         74
20250604 111914 worker: Saved MPD vol:      -1
20250604 111914 worker: Saved SRC vol:      0
20250604 111914 worker: MPD crossfade:      off
20250604 111914 worker: MPD ignore CUE:     no
20250604 111914 worker: MPD CDSP volsync:   off
20250604 111914 worker: --
20250604 111914 worker: -- Music sources
20250604 111914 worker: --
20250604 111914 worker: USB drives:     none
20250604 111914 worker: NVMe drives:    none
20250604 111914 worker: SATA drives:    none
20250604 111914 worker: NAS source:     nas (smb)
20250604 111930 worker: --
20250604 111930 worker: -- Feature availability
20250604 111930 worker: --
20250604 111930 worker: Input select:    available, Source: MPD, Output: snd_rpi_hifiberry_dac
20250604 111935 worker: Bluetooth:       started, PIN: None, ALSA/CDSP maxvol: 100%/0dB, ALSA outmode: Standard
20250604 111935 worker: Retry 1 waiting for metadata pipe
20250604 111936 worker: AirPlay:         started
20250604 111936 worker: Spotify Connect: available
20250604 111936 worker: Deezer Connect:  n/a
20250604 111936 worker: Squeezelite:     available
20250604 111936 worker: UPnP client:     available
20250604 111936 worker: Plexamp:         not installed, ALSA maxvol: 100%
20250604 111936 worker: RoonBridge:      not installed
20250604 111936 worker: Multiroom:       available
20250604 111936 worker: GPIO buttons:    available
20250604 111936 worker: Stream recorder: n/a
20250604 111936 worker: --
20250604 111936 worker: -- Security
20250604 111936 worker: --
20250604 111936 worker: Web SSH server:    off
20250604 111936 worker: XSS detection:     off
20250604 111936 worker: HTTPS mode:        available
20250604 111936 worker: --
20250604 111936 worker: -- Peripherals
20250604 111936 worker: --
20250604 111943 worker: Local display:   off
20250604 111943 worker: Chromium ver:    126.0.6478.164-rpt1
20250604 111943 worker: Chromium cfg:    directory ok
20250604 111943 worker: Screen blank     600
20250604 111943 worker: On-screen kbd:   off
20250604 111943 worker: Disable GPU:     off
20250604 111943 worker: HDMI orient:     landscape
20250604 111943 worker: HDMI 4K 60Hz:    off
20250604 111943 worker: DSI scn type:    none
20250604 111943 worker: DSI port:        1
20250604 111943 worker: DSI brightness:  255
20250604 111943 worker: DSI rotate:      0
20250604 111943 worker: Rotary encoder:  off
20250604 111943 worker: Triggerhappy:    off
20250604 111943 worker: LCD updater:     off
20250604 111943 worker: --
20250604 111943 worker: -- Miscellaneous
20250604 111943 worker: --
20250604 111943 worker: Software update:   Automatic check off
20250604 111943 worker: Auto-CoverView:    off
20250604 111943 worker: CoverView timeout: Never
20250604 111943 worker: Auto-shuffle:      off
20250604 111943 worker: Auto-play:         off
20250604 111943 worker: Maintenance task:  360 mins
20250604 111943 worker: Current view:      reset to Playback
20250604 111943 worker: Active flags:      all false
20250604 111943 worker: Reset flags:       skipped
20250604 111943 worker: Session check:     ok
20250604 111943 worker: --
20250604 111943 worker: -- Startup complete
20250604 111943 worker: --
20250604 111943 worker: Mount monitor:    started
20250604 111943 worker: Radio monitor:    off
20250604 111945 worker: Watchdog monitor: started
20250604 111945 worker: Responsiveness:   Default
20250604 111945 worker: Ready
Reply
#2
The symptoms suggest a network issue.

The log shows an unusual subnetted address space where DNS is on a different subnet than the moode host. This will cause breakage in moode multicast DNS which requires a single non-subnetted network.

Code:
20250604 111814 worker: Wireless: address 10.69.42.117
20250604 111814 worker: Wireless: netmask 255.255.240.0
20250604 111814 worker: Wireless: gateway 10.69.32.1
20250604 111814 worker: Wireless: pri DNS 10.69.32.1

There is breakage in the Audio configuration. ALSA card 0 is assigned to an I2S device but the ALSA output indicates a USB device. Its not clear to me how this might happen.

Code:
20250604 111815 worker: Audio device:  0:snd_rpi_hifiberry_dac
20250604 111815 worker: ALSA card:     has not been reassigned
20250604 111815 worker: MPD config:    update not needed
20250604 111909 worker: ALSA output:   USB
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(06-04-2025, 05:01 PM)Tim Curtis Wrote: The symptoms suggest a network issue.

The log shows an unusual subnetted address space where DNS is on a different subnet than the moode host. This will cause breakage in moode multicast DNS which requires a single non-subnetted network.

Code:
20250604 111814 worker: Wireless: address 10.69.42.117
20250604 111814 worker: Wireless: netmask 255.255.240.0
20250604 111814 worker: Wireless: gateway 10.69.32.1
20250604 111814 worker: Wireless: pri DNS 10.69.32.1
Mind the netmask---the subnet is 16 times bigger than if the netmask were 255.255.255.0. I don't have my subnet calculator handy to check but I think the addresses should be ok.
Regards,
Kent
Reply
#4
(06-04-2025, 05:20 PM)TheOldPresbyope Wrote: Mind the netmask---the subnet is 16 times bigger than if the netmask were 255.255.255.0. I don't have my subnet calculator handy to check but I think the addresses should be ok.

It's a /20 subnet (overkill but ¯\_(ツ)_/¯), and mDNS works fine on here, so I don't think this is likely the issue.

(06-04-2025, 05:01 PM)Tim Curtis Wrote: There is breakage in the Audio configuration. ALSA card 0 is assigned to an I2S device but the ALSA output indicates a USB device. Its not clear to me how this might happen.

Code:
20250604 111815 worker: Audio device:  0:snd_rpi_hifiberry_dac
20250604 111815 worker: ALSA card:     has not been reassigned
20250604 111815 worker: MPD config:    update not needed
20250604 111909 worker: ALSA output:   USB

The DAC is a PCM5102 I2S, set up using this tutorial. Not sure why it's showing as USB there. I'll do some more digging.

Output of `aplay -l` if it helps.

Code:
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 1: vc4hdmi [vc4-hdmi], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
Reply
#5
Oops missed the subnet mask. Good for 4000 pi's ;-)

Is there any reason you hand edited config.txt and created asound.conf? That prolly counts for the audio breakage since moode implements a managed config.txt and ALSA configuration.

I would revert any manual changes and just select "Generic I2S (hifiberry-dac)" from the Named I2S device list in Audio Config. This loads the hifiberry-dac driver overlay.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
I found why the audio output was funky. I'd edited `/boot/firmware/config.txt` by hand to get the DAC recognised rather than do it through the UI.

Code:
20250604 215326 worker: --
20250604 215326 worker: -- Audio configuration
20250604 215326 worker: --
20250604 215326 worker: Audio device:  0:Generic-I2S (i2s-dac)
20250604 215326 worker: ALSA card:     has not been reassigned
20250604 215326 worker: MPD config:    update not needed
20250604 215327 worker: ALSA output:   I2S
20250604 215327 worker: ALSA mode:     Default (plughw)
20250604 215327 worker: ALSA mixer:    none exists
20250604 215403 worker: ALSA volume:   controller not detected
20250604 215403 worker: ALSA maxvol:   100%
20250604 215403 worker: ALSA loopback: off
20250604 215403 worker: MPD mixer      Software
20250604 215403 worker: Integ audio:   vc4-kms-v3d
20250604 215403 worker: Audio formats: S16_LE, S24_LE
20250604 215403 worker: CamillaDSP:    off
20250604 215403 worker: CDSP volume:   0dB
20250604 215403 worker: CDSP volrange: 60dB

I'll update on whether this fixes the UI stability.
Reply
#7
That looks good.

Try running a ping test from the Pi to your Router. It should show something like "Destination Host Unreachable" and 100% packet loss when the 502 gateway condition happens. Also see if the ping stats show really long avg rtt and mdev.

Then check the wlan0 interface on the Pi

Code:
ifconfig
iwconfig
nmcli device show wlan0
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#8
One other debug to try is to open your Browsers javascript console and see if there any errors from moode playerlib.js or scripts-library.js
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#9
I think it's working ok now. The websocket requests were timing out network side but the requests didn't time out server side and the browser kept spawning new ones, which eventually exhausted the FPM pool if left running. So you were right about it being network side.

Fingers crossed it's still working in the morning.
Reply


Forum Jump: