Owntone segmentation fault

Has anyone installed owntone recently? I am getting a segmentation fault upon running it. I am a linux novice and any help on how to debug would be appreciated.

thanks,

jeremy

root@device:/home/owntone# /etc/init.d/owntone start
[2022-12-31 13:03:37] [  LOG]     main: OwnTone version 28.2 taking off
[2022-12-31 13:03:37] [  LOG]     main: Built with:
[2022-12-31 13:03:37] [  LOG]     main: - ffmpeg
[2022-12-31 13:03:37] [  LOG]     main: - Spotify
[2022-12-31 13:03:37] [  LOG]     main: - librespot-c
[2022-12-31 13:03:37] [  LOG]     main: - LastFM
[2022-12-31 13:03:37] [  LOG]     main: - Chromecast
[2022-12-31 13:03:37] [  LOG]     main: - MPD
[2022-12-31 13:03:37] [  LOG]     main: - Websockets
[2022-12-31 13:03:37] [  LOG]     main: - ALSA
[2022-12-31 13:03:37] [  LOG]     main: - Webinterface
[2022-12-31 13:03:37] [  LOG]     main: - Regex
Segmentation fault

Here is the log:

[2022-12-31 13:10:37] [  LOG]     main: OwnTone version 28.2 taking off
[2022-12-31 13:10:37] [  LOG]     main: Built with:
[2022-12-31 13:10:37] [  LOG]     main: - ffmpeg
[2022-12-31 13:10:37] [  LOG]     main: - Spotify
[2022-12-31 13:10:37] [  LOG]     main: - librespot-c
[2022-12-31 13:10:37] [  LOG]     main: - LastFM
[2022-12-31 13:10:37] [  LOG]     main: - Chromecast
[2022-12-31 13:10:37] [  LOG]     main: - MPD
[2022-12-31 13:10:37] [  LOG]     main: - Websockets
[2022-12-31 13:10:37] [  LOG]     main: - ALSA
[2022-12-31 13:10:37] [  LOG]     main: - Webinterface
[2022-12-31 13:10:37] [  LOG]     main: - Regex
[2022-12-31 13:10:37] [  LOG]     main: mDNS init
[2022-12-31 13:10:38] [  LOG]     mdns: Avahi state change: Client running
[2022-12-31 13:10:38] [  LOG]       db: Configured to use database file '/home/owntone/songs3.db'
[2022-12-31 13:10:38] [  LOG]       db: Now vacuuming database, this may take some time...
[2022-12-31 13:10:38] [  LOG]       db: Database OK with 0 active files and 6 active playlists

There's nothing it the snippets you pasted, providing any info about the seg fault.

What does dmesg say about it, afterwards?
And what's the output of
ubus call system board

dmesg says

[90434.529303] do_page_fault(): sending SIGSEGV to owntone for invalid write access to 77e2da94
[90434.537936] epc = 00456d74 in owntone[400000+104000]
[90434.542999] ra  = 00456d7c in owntone[400000+104000]
[90440.697799] do_page_fault(): sending SIGSEGV to owntone for invalid write access to 77da5a94
[90440.706432] epc = 00456d74 in owntone[400000+104000]
[90440.711491] ra  = 00456d7c in owntone[400000+104000]
[91487.765360] do_page_fault(): sending SIGSEGV to owntone for invalid read access from 00000000
[91487.774121] epc = 77e2e170 in libc.so[77da8000+a9000]
[91487.779389] ra  = 76a3ddf7 in libmxml.so.1.6[76a3c000+17000]
[91488.146504] do_page_fault(): sending SIGSEGV to owntone for invalid write access to 77da3a94
[91488.155143] epc = 00456d74 in owntone[400000+104000]
[91488.160200] ra  = 00456d7c in owntone[400000+104000]
[102407.399847] do_page_fault(): sending SIGSEGV to owntone for invalid read access from 00000000
[102407.408730] epc = 77e6c170 in libc.so[77de6000+a9000]
[102407.413967] ra  = 76a7bdf7 in libmxml.so.1.6[76a7a000+17000]
[102407.753269] do_page_fault(): sending SIGSEGV to owntone for invalid write access to 77de1a94
[102407.761990] epc = 00456d74 in owntone[400000+104000]
[102407.767163] ra  = 00456d7c in owntone[400000+104000]

ubus call system board

{
	"kernel": "5.10.146",
	"hostname": "xxx",
	"system": "Qualcomm Atheros QCA9558 ver 1 rev 0",
	"model": "TP-Link Archer C7 v2",
	"board_name": "tplink,archer-c7-v2",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "22.03.2",
		"revision": "r19803-9a599fee93",
		"target": "ath79/generic",
		"description": "OpenWrt 22.03.2 r19803-9a599fee93"
	}
}

I'm the maintainer of Owntone so I looked into it and was able to reproduce. The segfault seems to come from the libmxml library, which I also maintain. It's a bug in version 3.3, which the author fixed in version 3.3.1. The fixed version has been in OpenWrt for 5 months and I suppose will be in the next major release. Until then, maybe you can fix the problem by getting a snapshot ipk of libmxml. Not sure if that will work.

3 Likes

We could cherry pick the 3.3.1 bug fix version bump into 22.03
(Seems to be a simple bump without any other changes)

1 Like

Thanks @ejurgensen -- I can wait for the next release of OpenWrt.

jeremy

I cherry-picked the mxml bump to 3.3.1 into OpenWrt 22.03.
Buildbot should build the new package version in 1-2 days (for all targets)
You can then use opkg to install the 3.3.1 version.

1 Like

@hnyman that's great, thanks a lot for that.

This means libmxml will work, but unfortunately I found that there is also another issue causing OwnTone to segfault, this one caused by a change in ffmpeg 5 where a property that OwnTone 28.2 tries to change (AVOutputFormat.flags) became read-only. The invalid write causes SIGSEGV. The problem is fixed in 28.5, which is in OpenWrt packages master branch. Not sure what the best course of action (if any) would be here for 22.03, since it's less cherry-pickable?

The easiest course would be to backport also the necessary version bump commits for owntone. Preferably direct cherrypicks, but also manual backports are ok if necessary.

(Quite many packages get updates in 22.03)

Sounds good. Cherry-picking commit feda8e036d14a2ad2504da075a4323bfa033c6c6 (bump to 28.4) and commit 983006f12a041dfe9f4f7b8bee21b5b463453ee3 (bump to 28.5) should fix the issue.

Cherry-picked them.

1 Like

Hi @ejurgensen

Did the cherry-picked fixes make it into the new January 9 release (listed on the OpenWRT homepage)?

jeremy

Packages are built continuously. So, in practice: yes.

1 Like

Yes, I can confirm it's there. However, to make it work, I had to install it with opkg install libwebsockets-full owntone. The reason is that owntone just specifies libwebsockets as dependency, and that defaults to libwebsocket-mbedtls. That package seems to be broken, possibly because it is missing a dependency to libev. I would submit a pr, but I haven't gotten to the bottom of the issue.