Bug 1312 - clicking download link on some songs in web interface crashes server
: clicking download link on some songs in web interface crashes server
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Web Interface
: 6.0.1
: All All
: P2 normal (vote)
: ---
Assigned To: Dan Sully
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-04-05 11:06 UTC by Kevin Pearsall
Modified: 2008-08-18 10:53 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
sample file that causes a crash when attempting to download (3.38 MB, audio/mpg)
2005-04-05 11:07 UTC, Kevin Pearsall
Details
Patch to use IDs instead of virtual URLs for downloading. (4.55 KB, patch)
2005-04-05 14:14 UTC, Dan Sully
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Pearsall 2005-04-05 11:06:42 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.
Comment 1 Kevin Pearsall 2005-04-05 11:07:41 UTC
Created attachment 402 [details]
sample file that causes a crash when attempting to download
Comment 2 KDF 2005-04-05 11:18:46 UTC
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.
Comment 3 Eric Kasre 2005-04-05 11:42:53 UTC
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]
Comment 4 Kevin Pearsall 2005-04-05 11:46:20 UTC
when i tested it, it was just in the music folder.  no mapped drives, not in
itunes...
Comment 5 Kevin Pearsall 2005-04-05 11:49:29 UTC
also, the url it's giving me is:
http://localhost:9000/%2Fmusic%2F10%252C000%2520maniacs-10-trouble%2520me.mp3
Comment 6 Eric Kasre 2005-04-05 12:44:31 UTC
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).
Comment 7 Dan Sully 2005-04-05 14:14:08 UTC
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.
Comment 8 Kevin Pearsall 2005-04-05 15:39:23 UTC
Looking good here, Dan.
Comment 9 Dan Sully 2005-04-05 15:41:39 UTC
All checked into Subversion. This will be in the 6.0.1 release.
Comment 10 Eric Kasre 2005-04-05 18:40:57 UTC
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.
Comment 11 Eric Kasre 2005-04-06 06:06:42 UTC
Applied patch first thing this morning on the server... and all works PERFECTLY

thanks again, I will post if anything else is found.

Eric