Hi,
I've discovered a segfault in the latest release (1.1-5). I am running minidlna on alpine linux in a docker container.
Package: https://pkgs.alpinelinux.org/flag/edge/main/minidlna/1.1.5-r2
Container: https://github.com/vimagick/dockerfiles/tree/master/minidlna
Docker-compose file: http://pastebin.com/cuiCWzZZ
Minidlna config: http://pastebin.com/N0VqmVqQ
The problem comes when the scanning has succeded and later on I download a new file through rtorrent (running in another container).
Debug log from minidlna with comments: http://pastebin.com/xB4YHmxh
Here is the kernel log about the event:
Nov 1 14:13:08 lhs kernel: [1007319.342237] minidlnad[31295]: segfault at 7f3e4e717238 ip 000055a1b3b37e39 sp 00007f3e4e717240 error 6 in minidlnad[55a1b3b1f000+39000]
MD5 hash for the minidlnad binary: a03fea052f413d5add136e49175908fa
I could not reproduce the issue so far by manually creating and changing files.
If I can provide more symtoms, please tell.
Finnaly reproduced the crash with debug symbols.
Please find the backtrace here: http://pastebin.com/6jx9SNGb
Do you get this problem without using docker containers?
Not tried yet, because my host OS is debian (strech). Alpine comes with a different libc distribution, so I don't think I could even run alpine-compiled binary on debian. Or shall I recompile the same source for debian and run it like that?
I found an interesting workaround for the problem. If I set the plugin "auto-move" on in rtorrent and download the stuff under a temporary place, than with auto-move I get the content to the place where minidlna listens, the problem looks like to disappear. I have no exaplanation for that so far. May help for others as well...
Maybe try debian minidlna + rtorrent without containers to see if problem still exists.
It is probably best to keep files being modified outside of media_dir (or put in hidden dir) because minidlna will remove and re-add the file to the database each time the file is modified.
Hello,
Finnaly had time to debug this. Basically it caused stack underrun, and so SIGSEGV on my system (with 8192k stack ulimit size)
I've corrected multiple issues in this metadata.c patch:
http://pastebin.com/sY8401dv
- uninitalized string (GetVideoMetadata() - nfo) -> memset to 0
- stack was kicked with 64k buffer unconditionally (parse_nfo() - buf) -> now it is on heap and malloc'd size depends on filesize
Please add to the mainline if it seems ok.
Please note that alpine linux accepted an improved version of the patch:
http://patchwork.alpinelinux.org/patch/2940/