PDA

View Full Version : Another slimserver crash



Lars Kellogg-Stedman
2005-02-11, 06:29
Slimserver just crashed immediately after selecting "Browse playlists"
from the main menu. The last error in the log was:

Can't call method "artistsort" on an undefined value at
/home/slimserver/slim/server//Slim/Music/Info.pm line 939.

In general, I notice that my slimserver log is filled with "Use of
uninitialized value ..." errors, indicating that maybe there's not
enough error checking going on. Usually the errors are non-fatal, but
obviously one can't call a method on an undefined value.

What would be the appropriate fix here? The above error is in
getInfoForSort()...can this routine log an error and return an empty
list or something without causing a crash?

-- Lars

Dan Sully
2005-02-11, 13:45
* Lars Kellogg-Stedman shaped the electrons to say...

>Can't call method "artistsort" on an undefined value at
>/home/slimserver/slim/server//Slim/Music/Info.pm line 939.

Can you give this patch a try?

Index: Slim/Music/Info.pm
================================================== =================
--- Slim/Music/Info.pm (revision 2018)
+++ Slim/Music/Info.pm (working copy)
@@ -935,7 +935,7 @@
#Sets up an array entry for performing complex sorts
sub getInfoForSort {
my $item = shift;
- my $obj = $currentDB->objectForUrl($item);
+ my $obj = $currentDB->objectForUrl($item) || return [];

my $list = isList($obj);


>In general, I notice that my slimserver log is filled with "Use of
>uninitialized value ..." errors, indicating that maybe there's not
>enough error checking going on. Usually the errors are non-fatal, but
>obviously one can't call a method on an undefined value.

If you could get me a list of those, I'll take care of them.

Thanks.

-D
--
They're techno trousers, ex-NASA, fantastic for walkies!

kdf
2005-02-11, 14:09
Quoting Lars Kellogg-Stedman <lars (AT) oddbit (DOT) com>:

> Slimserver just crashed immediately after selecting "Browse playlists"
> from the main menu. The last error in the log was:
>
> Can't call method "artistsort" on an undefined value at
> /home/slimserver/slim/server//Slim/Music/Info.pm line 939.
>
> In general, I notice that my slimserver log is filled with "Use of
> uninitialized value ..." errors, indicating that maybe there's not
> enough error checking going on. Usually the errors are non-fatal, but
> obviously one can't call a method on an undefined value.
>
> What would be the appropriate fix here? The above error is in
> getInfoForSort()...can this routine log an error and return an empty
> list or something without causing a crash?

add this about 5 lines before the failure:
return [$item ,$list] unless $obj;

-kdf

Lars Kellogg-Stedman
2005-02-11, 19:36
In article <20050211204505.GA3666 (AT) electricrain (DOT) com>,
Dan Sully <dan (AT) slimdevices (DOT) com> wrote:

> Can you give this patch a try?

Just now sitting down to look at this. FWIW, the crash happens every
time I select "Browse Playlist" from the main menu. The complete text
logged is:

Use of uninitialized value in hash element at
/home/slimserver/slim/server//Slim/DataStores/DBI/DBIStore.pm line 125.
2005-02-11 21:30:17.8117 Null track request!
2005-02-11 21:30:17.8122 Backtrace:
frame 0: Slim::DataStores::DBI::DBIStore::objectForUrl
(/home/slimserver/slim/server//Slim/DataStores/DBI/DBIStore.pm line 131)
frame 1: Slim::DataStores::DBI::DBIStore::contentType
(/home/slimserver/slim/server//Slim/Music/Info.pm line 1556)
frame 2: Slim::Music::Info::isList
(/home/slimserver/slim/server//Slim/Music/Info.pm line 940)
frame 3: Slim::Music::Info::getInfoForSort
(/home/slimserver/slim/server//Slim/Music/Info.pm line 909)
frame 4: Slim::Music::Info::sortByAlbum
(/home/slimserver/slim/server//Slim/Utils/Scan.pm line 275)
frame 5: Slim::Utils::Scan::addToList_run
(/home/slimserver/slim/server//Slim/Utils/Scheduler.pm line 95)
frame 6: Slim::Utils::Scheduler::run_tasks
(/home/slimserver/slim/server/slimserver.pl line 544)
frame 7: main::idle (/home/slimserver/slim/server/slimserver.pl line
503)
frame 8: main::main (/home/slimserver/slim/server/slimserver.pl line
1019)
Use of uninitialized value in hash element at
/home/slimserver/slim/server//Slim/DataStores/DBI/DBIStore.pm line 139.
Can't call method "artistsort" on an undefined value at
/home/slimserver/slim/server//Slim/Music/Info.pm line 943.

-- Lars

Dan Sully
2005-02-11, 19:42
* Lars Kellogg-Stedman shaped the electrons to say...

>In article <20050211204505.GA3666 (AT) electricrain (DOT) com>,
> Dan Sully <dan (AT) slimdevices (DOT) com> wrote:
>
>> Can you give this patch a try?
>
>Just now sitting down to look at this. FWIW, the crash happens every
>time I select "Browse Playlist" from the main menu. The complete text
>logged is:

Lars - if you could sync up to the latest SVN, I believe I've fixed this.

Thanks.

-D
--
This knob controls the thing that changes when you turn it. - noah

Lars Kellogg-Stedman
2005-02-11, 19:49
> Just now sitting down to look at this. FWIW, the crash happens every
> time I select "Browse Playlist" from the main menu.

Ooo, this is wacky. After applying your patch, slimserver no longer
crashes...but the first menu item available in the "Browse Playlist"
menu is "Browse Playlist."

While that secondary "Browse Playlist" is selected, there's a continuous
stream of errors in the log, much like the trace posted in my previous
message. I've posted one iteration of this below.

You can scroll down the list and actually see playlists...err, sort of.
You can see directories, but an actual playlist in the playlists
directory doesn't show up.

The errors:

2005-02-11 21:40:54.5262 Null track request!
2005-02-11 21:40:54.5291 Backtrace:
frame 0: Slim::DataStores::DBI::DBIStore::objectForUrl
(/home/slimserver/slim/server//Slim/Music/Info.pm line 621)
frame 1: Slim::Music::Info::standardTitle
(/home/slimserver/slim/server//Slim/Buttons/Browse.pm line 455)
frame 2: Slim::Buttons::Browse::line2
(/home/slimserver/slim/server//Slim/Buttons/Browse.pm line 403)
frame 3: Slim::Buttons::Browse::lines
(/home/slimserver/slim/server//Slim/Display/Display.pm line 120)
frame 4: Slim::Display::Display::curLines
(/home/slimserver/slim/server//Slim/Player/Player.pm line 166)
frame 5: Slim::Player::Player::update
(/home/slimserver/slim/server//Slim/Buttons/Browse.pm line 74)
frame 6: Slim::Buttons::Browse::__ANON__
(/home/slimserver/slim/server//Slim/Hardware/IR.pm line 613)
frame 7: Slim::Hardware::IR::executeButton
(/home/slimserver/slim/server//Slim/Control/Command.pm line 572)
frame 8: Slim::Control::Command::execute
(/home/slimserver/slim/server//Slim/Hardware/IR.pm line 637)
frame 9: Slim::Hardware::IR::processCode
(/home/slimserver/slim/server//Slim/Hardware/IR.pm line 455)
frame 10: Slim::Hardware::IR::processIR
(/home/slimserver/slim/server//Slim/Control/Command.pm line 572)
frame 11: Slim::Control::Command::execute
(/home/slimserver/slim/server//Slim/Hardware/IR.pm line 87)
frame 12: Slim::Hardware::IR::idle
(/home/slimserver/slim/server/slimserver.pl line 537)
frame 13: main::idle (/home/slimserver/slim/server/slimserver.pl line
503)
frame 14: main::main (/home/slimserver/slim/server/slimserver.pl line
1019)
Use of uninitialized value in hash element at
/home/slimserver/slim/server//Slim/DataStores/DBI/DBIStore.pm line 125.
Use of uninitialized value in hash element at
/home/slimserver/slim/server//Slim/Music/Info.pm line 1415.
Use of uninitialized value in exists at
/home/slimserver/slim/server/CPAN/Tie/Cache/LRU/Array.pm line 71.
Use of uninitialized value in split at
/home/slimserver/slim/server//Slim/Music/Info.pm line 1424.
Use of uninitialized value in hash element at
/home/slimserver/slim/server//Slim/Music/Info.pm line 1424.

Lars Kellogg-Stedman
2005-02-11, 20:00
In article <20050212024215.GA20314 (AT) electricrain (DOT) com>,
Dan Sully <dan (AT) slimdevices (DOT) com> wrote:

> Lars - if you could sync up to the latest SVN, I believe I've fixed this.

Now at rev 2021. Whoops, looks like I need to rebuild the database
again:

DBD::SQLite::db do failed: table albums has 7 columns but 6 values were
supplied(1) at dbdimp.c line 263 at
/oddbit/home/slimserver/slim/server//Slim/DataStores/DBI/DataModel.pm
line 66, <$fh> line 44.

Removed the database, and got a huge chunk of output in the log. I've
just attached it to this message to avoid ugly wrapping issues. Ping me
if the attachment gets whacked by the list and I can mail it to you
directly.

If I run it *again*, it dies immediately:

DBD::SQLite::db do failed: table albums_backup has 6 columns but 7
values were supplied(1) at dbdimp.c line 263 at
/home/slimserver/slim/server//Slim/DataStores/DBI/DataModel.pm line 66,
<$fh> line 44.

-- Lars


AlienBBC reports Version 6 Server says: 1
2005-02-11 21:56:51.1696 Backtrace:

frame 0: Slim::Utils::Misc::assert (/home/slimserver/slim/server//Slim/Networking/Slimproto.pm line 182)
frame 1: Slim::Networking::Slimproto::client_readable (/home/slimserver/slim/server//Slim/Networking/Select.pm line 116)
frame 2: Slim::Networking::Select::select (/home/slimserver/slim/server/slimserver.pl line 574)
frame 3: main::idleStreams (/home/slimserver/slim/server//Slim/Player/Protocols/HTTP.pm line 281)
frame 4: Slim::Player::Protocols::HTTP::content (/home/slimserver/slim/server//Plugins/RssNews.pm line 395)
frame 5: Plugins::RssNews::getFeedXml (/home/slimserver/slim/server//Plugins/RssNews.pm line 447)
frame 6: Plugins::RssNews::retrieveNews (/home/slimserver/slim/server//Plugins/RssNews.pm line 565)
frame 7: Plugins::RssNews::autoScrollTimer (/home/slimserver/slim/server//Plugins/RssNews.pm line 737)
frame 8: Plugins::RssNews::setScreensaverRssNewsMode (/home/slimserver/slim/server//Slim/Buttons/Common.pm line 1141)
frame 9: Slim::Buttons::Common::pushMode (/home/slimserver/slim/server//Slim/Buttons/ScreenSaver.pm line 106)
frame 10: Slim::Buttons::ScreenSaver::screenSaver (/home/slimserver/slim/server//Slim/Player/Player.pm line 147)
frame 11: Slim::Player::Player::init (/home/slimserver/slim/server//Slim/Networking/Slimproto.pm line 327)
frame 12: Slim::Networking::Slimproto::process_slimproto_fra me (/home/slimserver/slim/server//Slim/Networking/Slimproto.pm line 233)
frame 13: Slim::Networking::Slimproto::client_readable (/home/slimserver/slim/server//Slim/Networking/Select.pm line 116)
frame 14: Slim::Networking::Select::select (/home/slimserver/slim/server/slimserver.pl line 560)
frame 15: main::idle (/home/slimserver/slim/server/slimserver.pl line 503)
frame 16: main::main (/home/slimserver/slim/server/slimserver.pl line 1019)

Here's the problem. /home/slimserver/slim/server//Slim/Networking/Slimproto.pm, line 182:

172 if ($parser_state{$s} eq 'OP') {
173 $bytes_remaining = 4 - length($inputbuffer{$s});
174 assert ($bytes_remaining <= 4);
175 } elsif ($parser_state{$s} eq 'LENGTH') {
176 $bytes_remaining = 4 - length($inputbuffer{$s});
177 assert ($bytes_remaining <= 4);
178 } else {
179 assert ($parser_state{$s} eq 'DATA');
180 $bytes_remaining = $parser_framelength{$s} - length($inputbuffer{$s});
181 }
182 assert ($bytes_remaining > 0);
183
184 $::d_slimproto_v && msg("attempting to read $bytes_remaining bytes\n");
185
186 my $indata;
187 my $bytes_read = $s->sysread($indata, $bytes_remaining);
188
189 if (!defined($bytes_read) || ($bytes_read == 0)) {
190 if ($total_bytes_read == 0) {
191 $::d_slimproto && msg("Slimproto half-close from client: ".$ipport{$s}."\n");
192 slimproto_close($s);

getpeername() on closed socket GEN5 at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/IO/Socket.pm line 206.
getpeername() on closed socket GEN5 at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/IO/Socket.pm line 206.

Dan Sully
2005-02-11, 20:05
Ok - so the DB upgrade code needs a bit more work. I'm going to put a work around in for now.


* Lars Kellogg-Stedman shaped the electrons to say...

>In article <20050212024215.GA20314 (AT) electricrain (DOT) com>,
> Dan Sully <dan (AT) slimdevices (DOT) com> wrote:
>
>> Lars - if you could sync up to the latest SVN, I believe I've fixed this.
>
>Now at rev 2021. Whoops, looks like I need to rebuild the database
>again:
>
>DBD::SQLite::db do failed: table albums has 7 columns but 6 values were
>supplied(1) at dbdimp.c line 263 at
>/oddbit/home/slimserver/slim/server//Slim/DataStores/DBI/DataModel.pm
>line 66, <$fh> line 44.
>
>Removed the database, and got a huge chunk of output in the log. I've
>just attached it to this message to avoid ugly wrapping issues. Ping me
>if the attachment gets whacked by the list and I can mail it to you
>directly.
>
>If I run it *again*, it dies immediately:
>
>DBD::SQLite::db do failed: table albums_backup has 6 columns but 7
>values were supplied(1) at dbdimp.c line 263 at
>/home/slimserver/slim/server//Slim/DataStores/DBI/DataModel.pm line 66,
><$fh> line 44.
>
>-- Lars
>

>AlienBBC reports Version 6 Server says: 1
>2005-02-11 21:56:51.1696 Backtrace:
>
> frame 0: Slim::Utils::Misc::assert (/home/slimserver/slim/server//Slim/Networking/Slimproto.pm line 182)
> frame 1: Slim::Networking::Slimproto::client_readable (/home/slimserver/slim/server//Slim/Networking/Select.pm line 116)
> frame 2: Slim::Networking::Select::select (/home/slimserver/slim/server/slimserver.pl line 574)
> frame 3: main::idleStreams (/home/slimserver/slim/server//Slim/Player/Protocols/HTTP.pm line 281)
> frame 4: Slim::Player::Protocols::HTTP::content (/home/slimserver/slim/server//Plugins/RssNews.pm line 395)
> frame 5: Plugins::RssNews::getFeedXml (/home/slimserver/slim/server//Plugins/RssNews.pm line 447)
> frame 6: Plugins::RssNews::retrieveNews (/home/slimserver/slim/server//Plugins/RssNews.pm line 565)
> frame 7: Plugins::RssNews::autoScrollTimer (/home/slimserver/slim/server//Plugins/RssNews.pm line 737)
> frame 8: Plugins::RssNews::setScreensaverRssNewsMode (/home/slimserver/slim/server//Slim/Buttons/Common.pm line 1141)
> frame 9: Slim::Buttons::Common::pushMode (/home/slimserver/slim/server//Slim/Buttons/ScreenSaver.pm line 106)
> frame 10: Slim::Buttons::ScreenSaver::screenSaver (/home/slimserver/slim/server//Slim/Player/Player.pm line 147)
> frame 11: Slim::Player::Player::init (/home/slimserver/slim/server//Slim/Networking/Slimproto.pm line 327)
> frame 12: Slim::Networking::Slimproto::process_slimproto_fra me (/home/slimserver/slim/server//Slim/Networking/Slimproto.pm line 233)
> frame 13: Slim::Networking::Slimproto::client_readable (/home/slimserver/slim/server//Slim/Networking/Select.pm line 116)
> frame 14: Slim::Networking::Select::select (/home/slimserver/slim/server/slimserver.pl line 560)
> frame 15: main::idle (/home/slimserver/slim/server/slimserver.pl line 503)
> frame 16: main::main (/home/slimserver/slim/server/slimserver.pl line 1019)
>
>Here's the problem. /home/slimserver/slim/server//Slim/Networking/Slimproto.pm, line 182:
>
>172 if ($parser_state{$s} eq 'OP') {
>173 $bytes_remaining = 4 - length($inputbuffer{$s});
>174 assert ($bytes_remaining <= 4);
>175 } elsif ($parser_state{$s} eq 'LENGTH') {
>176 $bytes_remaining = 4 - length($inputbuffer{$s});
>177 assert ($bytes_remaining <= 4);
>178 } else {
>179 assert ($parser_state{$s} eq 'DATA');
>180 $bytes_remaining = $parser_framelength{$s} - length($inputbuffer{$s});
>181 }
>182 assert ($bytes_remaining > 0);
>183
>184 $::d_slimproto_v && msg("attempting to read $bytes_remaining bytes\n");
>185
>186 my $indata;
>187 my $bytes_read = $s->sysread($indata, $bytes_remaining);
>188
>189 if (!defined($bytes_read) || ($bytes_read == 0)) {
>190 if ($total_bytes_read == 0) {
>191 $::d_slimproto && msg("Slimproto half-close from client: ".$ipport{$s}."\n");
>192 slimproto_close($s);
>
>getpeername() on closed socket GEN5 at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/IO/Socket.pm line 206.
>getpeername() on closed socket GEN5 at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/IO/Socket.pm line 206.

>