jcorporation / myMPD

myMPD is a standalone and mobile friendly web mpd client with a tiny footprint and advanced features.
https://jcorporation.github.io/myMPD/
GNU General Public License v3.0
419 stars 65 forks source link

Segmentation fault #411

Closed audnex closed 3 years ago

audnex commented 3 years ago

myMPD version: 6.9.0

myMPD works for a while then it seems after a while (maybe 5-10minutes) it hands with Seg Fault. Any ideas from the log?

Log is below: 04:17:42 INFO mympd Starting myMPD 6.9.0 04:17:42 INFO mympd Libmympdclient 1.0.4 based on libmpdclient 2.20.0 04:17:42 INFO mympd Mongoose 6.18 04:17:42 INFO mympd Parsing config file: /etc/mympd.conf 04:17:42 INFO mympd Setting loglevel to INFO 04:17:42 INFO mympd Localstate dir: "/var/lib/mympd" 04:17:42 INFO mympd SSL certificates: "/var/lib/mympd/ssl" 04:17:42 INFO mympd CA certificate and private key found 04:17:42 INFO mympd Server certificate and private key found 04:17:42 INFO mympd Listening on http port 8080 04:17:42 INFO mympd Listening on ssl port 443 04:17:42 INFO mympd Droping privileges to mympd 04:17:42 INFO mympd Smartpls dir: "/var/lib/mympd/smartpls" 04:17:42 INFO mympd State dir: "/var/lib/mympd/state" 04:17:42 INFO mympd Pics dir: "/var/lib/mympd/pics" 04:17:42 INFO mympd Empty dir: "/var/lib/mympd/empty" 04:17:42 INFO mympd Covercache dir: "/var/lib/mympd/covercache" 04:17:42 INFO mympd MPD playlists dir: "/var/lib/mpd/playlists" 04:17:42 INFO mympd Starting mympd api thread 04:17:42 INFO mympd Starting mpd worker thread 04:17:42 INFO mympd Starting mpd client thread 04:17:42 INFO mympd Starting webserver thread 04:17:42 INFO mympdapi Reading states 04:17:42 INFO mpdclient Starting mpd_client 04:17:42 INFO mpdclient MPD connecting to socket /var/run/mpd/socket 04:17:42 INFO mpdclient MPD connected 04:17:42 INFO mpdclient MPD protocoll version: 0.21.11 04:17:42 INFO mpdclient MPD music_directory: "/var/lib/mpd/music" 04:17:42 INFO mpdworker Starting mpd_worker 04:17:42 INFO mpdworker MPD worker connecting to socket /var/run/mpd/socket 04:17:42 INFO mpdworker MPD worker connected 04:17:42 INFO mpdworker MPD supported tags: Artist ArtistSort Album AlbumSort AlbumArtist AlbumArtistSort Title Track Name Genre Date OriginalDate Composer Performer Disc Label MUSICBRAINZ_ARTISTID MUSICBRAINZ_ALBUMID MUSICBRAINZ_ALBUMARTISTID MUSICBRAINZ_TRACKID MUSICBRAINZ_RELEASETRACKID MUSICBRAINZ_WORKID 04:17:42 INFO mpdworker Enabled mympdtags: Artist Album AlbumArtist Title Track Genre Date Disc 04:17:42 INFO mpdworker Enabled generate pls tags: Genre 04:17:42 INFO mpdclient Enabling featLibrary support 04:17:42 INFO mpdclient MPD supported tags: Artist ArtistSort Album AlbumSort AlbumArtist AlbumArtistSort Title Track Name Genre Date OriginalDate Composer Performer Disc Label MUSICBRAINZ_ARTISTID MUSICBRAINZ_ALBUMID MUSICBRAINZ_ALBUMARTISTID MUSICBRAINZ_TRACKID MUSICBRAINZ_RELEASETRACKID MUSICBRAINZ_WORKID 04:17:42 INFO mpdclient Enabled mympdtags: Artist Album AlbumArtist Title Track Genre Date Disc 04:17:42 INFO mpdclient Enabled searchtags: Artist Album AlbumArtist Title Genre 04:17:42 INFO mpdclient Enabled browsetags: Artist Album AlbumArtist Genre 04:17:42 INFO mpdclient Enabled generate pls tags: Genre 04:17:42 INFO mpdclient Enabling single oneshot feature 04:17:45 WARN webserver Unknown connection 04:17:45 WARN webserver Unknown connection 04:17:45 WARN webserver Unknown connection 04:17:45 WARN webserver Unknown connection 04:17:45 ERROR mympdapi Unknown API request: {"jsonrpc":"2.0","id":0,"method":"MYMPD_API_SCRIPT_LIST","params":{"all":true}} 04:17:45 WARN webserver Unknown connection 04:17:45 WARN webserver Unknown connection 04:17:45 WARN webserver Unknown connection 04:18:42 INFO mympdapi Cleaning covercache /var/lib/mympd/covercache 04:18:42 INFO mympdapi Deleted 0 files from covercache 04:18:55 INFO mpdclient Update database ID: 3 04:18:55 INFO mpdclient Update database ID: 0 04:18:58 INFO mpdclient Update database ID: 4 04:18:58 INFO mpdclient Update database ID: 0 Segmentation fault

Server plattform (please complete the following information):

Client plattform (please complete the following information):

confs.zip

jcorporation commented 3 years ago

Is the error reproducible on your side? Please enable debug logging and update to the latest release.

audnex commented 3 years ago

Thanks, yes its repeatable.

We can try 6.10 but cannot upgrade MPD past 21.26 due to build dependencies - is mympd v6.10 with mpd v0.21.26 compatible?

jcorporation commented 3 years ago

Yes, myMPD is compatible with mpd 0.21.x. A debug build can also help to narrow down the bug. Try to compile with libasan or run it under valgrind:

https://github.com/jcorporation/myMPD/wiki/Building-myMPD

https://github.com/jcorporation/myMPD/wiki/Debug

audnex commented 3 years ago

Hi, we updated to v6.11 and still get the segmentation fault (winin 30min to 1hour). Radio stream keeps playing after crash. The target is quite small on mem so we cannot use valgrind so looking at catchsegv and just straight gdb. We use Yocto and also have a nginx webserver on same target.

jcorporation commented 3 years ago

Try to compile in debug mode, libasan should print helpful error messages. Enabling debug mode of mympd can also be helpful.

Yocto, you are building a own linux distribution? Is this a public project?

tunephysics commented 3 years ago

trying to build the memchk version with catchsegv we get the following error when running:

that seems to have introduced an issue that means mympd not longer runs - log below (some issue with htdocs):

20:46:20 DEBUG mympd /home/audnex/toradex-mender-workspace/build-toradex/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/mympd/6.11.0-r0/git/src/web_server.c:106: Using certificate: /var/lib/mympd/ssl/server.pem 20:46:20 DEBUG mympd /home/audnex/toradex-mender-workspace/build-toradex/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/mympd/6.11.0-r0/git/src/web_server.c:107: Using private key: /var/lib/mympd/ssl/server.key 20:46:20 INFO mympd /home/audnex/toradex-mender-workspace/build-toradex/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/mympd/6.11.0-r0/git/src/main.c:142: Droping privileges to mympd 20:46:20 ERROR mympd /home/audnex/toradex-mender-workspace/build-toradex/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/mympd/6.11.0-r0/git/src/utility.c:231: Document root: "/home/audnex/toradex-mender-workspace/build-toradex/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/mympd/6.11.0-r0/git/htdocs" don't exists

jcorporation commented 3 years ago

It seems the mympd user has no access rights for the htdocs directory.

audnex commented 3 years ago

Ok. We didnt have much luck cross-compiling but after a lot of testing changing journald to use RAM rather than Flash so far (over 24hours) seems to eliminate crash (no idea why). We will update to your next release with null pointer fix also https://github.com/jcorporation/myMPD/commit/0df1ee245346a8fda2cbc0c785ffbb0f6521f559