Bugzilla – Bug 1312
clicking download link on some songs in web interface crashes server
Last modified: 2008-08-18 10:53:41 UTC
observed in svn r2884 (trunk). reseller reported bug. attaching a file sent by the reporter that causes a crash every time it's clicked. error is: Can't call method "filesize" on an undefined value at /Users/kpearsall/trunk/server/Slim/Web/HTTP.pm line 823.
Created attachment 402 [details] sample file that causes a crash when attempting to download
how is this file stored in relation to the slimerver? shortcut, mapped drive? this might be related to another bug that I can't find at the moment. The download url was not always being converted to a proper http:// url because the translation relies on a clean match to the audiodir. this might cause the objectForURL call that precedes this crash to fail. a sanity check can prevent the crash, but more may be needed to make all download links work properly.
I'm trying to follow all this and help out with what I can. All the media files are stored in their own partitioned drive on this windows machine within a directory called "music" I don't know if this helps but the link that the download link calls to is: http://media_xp:9000/%2Fmusic%2F10%252C000%2520maniacs%2Fmtv%2520unplugged% 2F10%252C000%2520maniacs-10-trouble%2520me.mp3 the directory and file name is: D:\Music\10,000 maniacs\mtv unplugged\10,000 maniacs-10-trouble me.mp3 ....again it isn't only with this file. It happens with quite a few of them. [American Communications - Slim Devices Dealer]
when i tested it, it was just in the music folder. no mapped drives, not in itunes...
also, the url it's giving me is: http://localhost:9000/%2Fmusic%2F10%252C000%2520maniacs-10-trouble%2520me.mp3
It looks like the call to Slim::DataStores::DBI::Track-search() in _retrieveTrack() in Slim/DataStores/DBI/DBIStore.pm is returning undef and nobody's catching that until someone tries to call the filesize() method on it in Web/HTTP.pm's generateHTTPResponse. To get a stacktrace, you can add use Carp; confess("Thar she blows!") unless defined $track; after the line that reads ($track) = Slim::DataStores::DBI::Track->search('url' => $url); in DBIStore.pm, then use the link mentioned in the bug. You'll get this: Thar she blows! at /usr/local/slimserver/Slim/DataStores/DBI/DBIStore.pm line 993 Slim::DataStores::DBI::DBIStore::_retrieveTrack('Slim::DataStores::DBI::DBIStore=HASH(0x951f554)', 'file:///data/music/All/kazam/bob%20dylan%20%26%20the%20band', 'undef') called at /usr/local/slimserver/Slim/DataStores/DBI/DBIStore.pm line 148 Slim::DataStores::DBI::DBIStore::objectForUrl('Slim::DataStores::DBI::DBIStore=HASH(0x951f554)', 'file:///data/music/All/kazam/bob%20dylan%20%26%20the%20band') called at /usr/local/slimserver/Slim/DataStores/DBI/DBIStore.pm line 122 Slim::DataStores::DBI::DBIStore::contentType('Slim::DataStores::DBI::DBIStore=HASH(0x951f554)', 'file:///data/music/All/kazam/bob%20dylan%20%26%20the%20band') called at /usr/local/slimserver/Slim/Music/Info.pm line 1616 Slim::Music::Info::isType('file:///data/music/All/kazam/bob%20dylan%20%26%20the%20band', 'dir') called at /usr/local/slimserver/Slim/Music/Info.pm line 1675 Slim::Music::Info::isDir('file:///data/music/All/kazam/bob%20dylan%20%26%20the%20band') called at /usr/local/slimserver/Slim/Utils/Misc.pm line 595 Slim::Utils::Misc::virtualToAbsolute('kazam/bob%20dylan%20%26%20the%20band/the%20basement%20tapes/b...') called at /usr/local/slimserver/Slim/Web/HTTP.pm line 809 Slim::Web::HTTP::generateHTTPResponse('undef', 'HTTP::Daemon::ClientConn=GLOB(0x95a9344)', 'HTTP::Response=HASH(0x9643044)', 'HASH(0x931cd24)') called at /usr/local/slimserver/Slim/Web/HTTP.pm line 665 Slim::Web::HTTP::processURL('HTTP::Daemon::ClientConn=GLOB(0x95a9344)', 'HTTP::Response=HASH(0x9643044)', 'HASH(0x931cd24)') called at /usr/local/slimserver/Slim/Web/HTTP.pm line 529 Slim::Web::HTTP::processHTTP('HTTP::Daemon::ClientConn=GLOB(0x95a9344)') called at /usr/local/slimserver/Slim/Networking/Select.pm line 115 Slim::Networking::Select::select(0.99766993522644) called at ./slimserver.pl line 606 main::idle() called at ./slimserver.pl line 549 main::main() called at ./slimserver.pl line 1111 (I used a different song, and so a different URL, but the bug is the same).
Created attachment 403 [details] Patch to use IDs instead of virtual URLs for downloading. Eric - could you try this patch? It reworks the downloading bits to not use URLs. Also - for a better backtrace: Slim::Utils::Misc::bt(); I've been unable to reproduce this here, however. Thanks.
Looking good here, Dan.
All checked into Subversion. This will be in the 6.0.1 release.
I will give it a try next I'm in the office. I hope it works. Thanks for the speedy help. I will post back.
Applied patch first thing this morning on the server... and all works PERFECTLY thanks again, I will post if anything else is found. Eric