"Select task failed" error message logged on every LMS v9.1.0 startup
The following message recently began showing up in my log immediately after each LMS restart. Any ideas on what is causing it or how to track it down?
[25-02-13 19:33:21.6752] main::init (282) Starting Lyrion Music Server (v9.1.0, 1739042606, Sun Feb 9 03:44:07 UTC 2025) perl 5.028001 - arm-linux-gnueabihf-thread-multi-64int
[25-02-13 19:33:24.8806] main::init (555) Server done init: http://192.168.1.28:9000
[25-02-13 19:33:25.5070] Slim::Networking::IO::Select::__ANON__ (131) Error: Select task failed calling Slim::Networking::Slimproto::client_readable: Can't use string ("1") as a symbol ref while "strict refs" in use at /usr/share/perl5/Slim/Networking/IO/Select.pm line 153. ; fh=IO::Socket::INET=GLOB(0x518e2e8)
Haven't seen this. Can you confirm this does still happen with all 3rd party plugins disabled?
You could also increase logging for network.protocol.slimproto` to see whether that gives some more information.
Thanks, Michael. I did some investigating with network.protocol.slimproto logging set to INFO and traced the source of the problem to one of my Goggle Nest Minis being rejected in Slim::Networking::Slimproto::_hello_handler for some reason.
[25-02-14 12:50:26.8306] Slim::Networking::Slimproto::_hello_handler (993) Squeezebox says hello: Deviceid: 12 revision: 0 mac: cc:cc:11:c6:fe:26 uuid: 00000000000000000000000000000000 bitmapped: 0 reconnect: 0 wlan_channellist: 0000 lang: bytes_received: 0 capabilities: CanHTTPS=1,Model=squeezelite,ModelName=CastBridge,AccuratePlayPoints=0,HasDigitalOut=1,MaxSampleRate=96000,aac,ogg,ops,ogf,flc,alc,wav,aif,pcm,mp3
[25-02-14 12:50:26.8312] Slim::Networking::Slimproto::_hello_handler (1125) Forgetting client, it is not a Slim::Player::SqueezePlay
[25-02-14 12:50:26.8324] Slim::Networking::Slimproto::slimproto_close (247) connection closed
[25-02-14 12:50:26.8385] Slim::Networking::IO::Select::__ANON__ (131) Error: Select task failed calling Slim::Networking::Slimproto::client_readable: Can't use string ("1") as a symbol ref while "strict refs" in use at /usr/share/perl5/Slim/Networking/IO/Select.pm line 153.
; fh=IO::Socket::INET=GLOB(0x6525ed8)
It turns out that my other Google Nest Mini that is on Google's Firmware Preview program, running a newer firmware version, does not have the problem so I am hoping that updating the firmware on this one will resolve the issue which, by the way, does not seem to cause any operational problems with the Mini as an LMS player that I use every morning as part of my wakeup alarm.
I am still concerned about the error message though, which seems to be coming from action taken in the slimproto_close() routine.
Well, it looked promising but updating the firmware made no difference. As I mentioned, the Nest Mini works fine so this error message is both unnecessary and impossible to suppress without a code change, as it uses an unconditional logError() call. The underlying error:
Can't use string ("1") as a symbol ref while "strict refs" in use at /usr/share/perl5/Slim/Networking/IO/Select.pm line 153
is being generated by the marked line in the following block of code from Slim/Networking/IO/Select.pm, which is outside of my knowledge base. Any help would be appreciated.
sub _remove {
my ( $mode, $fh ) = @_;
main::DEBUGLOG && $log->is_debug && $log->debug(
sprintf('fh=>%s(%d), mode=%s',
defined($fh) ? $fh : 'undef', defined($fh) ? fileno($fh) : -1,
$mode == EV::READ ? 'READ' : $mode == EV::WRITE ? 'WRITE' : "??-$mode"));
return unless defined $fh;
my $slot = $mode == EV::READ ? '_ev_r' : '_ev_w';
my $w = ${*$fh}{$slot} || return; <<<<<< ERROR
$w->stop;
delete ${*$fh}{$slot};
}
Could you add a logBacktrace() if !ref $fh or similar to see where the call is coming from?
Here is the backtrace. It appears that it is trying to register the Google Nest Mini I referenced previously. As I mentioned, I have another Nest Mini running the same firmware release that is registered successfully and it appears that this one is also registered successfully about 36 seconds after this failure, at 12:57:48.
[25-02-18 12:57:12.7326] Slim::Networking::IO::Select::_remove (153) Backtrace:
frame 0: Slim::Utils::Log::logBacktrace (/usr/share/perl5/Slim/Networking/IO/Select.pm line 153)
frame 1: Slim::Networking::IO::Select::_remove (/usr/share/perl5/Slim/Networking/IO/Select.pm line 62)
frame 2: Slim::Networking::IO::Select::removeRead (/usr/share/perl5/Slim/Networking/Slimproto.pm line 250)
frame 3: Slim::Networking::Slimproto::slimproto_close (/usr/share/perl5/Slim/Player/Client.pm line 565)
frame 4: Slim::Player::Client::forgetClient (/usr/share/perl5/Slim/Networking/Slimproto.pm line 1127)
frame 5: Slim::Networking::Slimproto::_hello_handler (/usr/share/perl5/Slim/Networking/Slimproto.pm line 434)
frame 6: Slim::Networking::Slimproto::client_readable (/usr/share/perl5/Slim/Networking/IO/Select.pm line 123)
frame 7: (eval) (/usr/share/perl5/Slim/Networking/IO/Select.pm line 119)
frame 8: Slim::Networking::IO::Select::__ANON__ (/usr/share/perl5/Slim/Networking/IO/Select.pm line 170)
frame 9: (eval) (/usr/share/perl5/Slim/Networking/IO/Select.pm line 170)
frame 10: Slim::Networking::IO::Select::loop (/usr/sbin/squeezeboxserver line 615)
frame 11: main::idle (/usr/sbin/squeezeboxserver line 570)
frame 12: main::main (/usr/sbin/squeezeboxserver line 1106)
[25-02-18 12:57:12.7356] Slim::Networking::IO::Select::__ANON__ (131) Error: Select task failed calling Slim::Networking::Slimproto::client_readable: Can't use string ("1") as a symbol ref while "strict refs" in use at /usr/share/perl5/Slim/Networking/IO/Select.pm line 155.
; fh=IO::Socket::INET=GLOB(0x48c4320)
I removed the problematic Nest Mini from the Chromecast Bridge plugin prefs and verified that the error no longer occurred. As soon as I added it back, however, the error message returned. I also verified that all the CC Bridge settings were exactly the same for both Nest Mini devices. This a tough one to figure out but it's also really just an annoyance, as the player seems to register successfully on the second try. I just don't like seeing this error message in the log every time I restart LMS.
@michaelherger I am currently testing with the following change in subroutine forgetClient() at line 564 of Slim/Player/Client.pm that eliminates the error. However, I am not certain of its validity. Any thoughts? Note that the call to slimproto_close() was added as a fix to Bug 15860 many years ago. The part I am unsure of is adding the check for ref $client->tcpsock. Without it, however, it seems that the value of $client->tcpsock being passed to slimproto_close() is '1'.
# Bug 15860: Force the connection shut if it is not already
# Slim::Networking::Slimproto::slimproto_close($client->tcpsock()) if defined $client->tcpsock();
if (defined $client->tcpsock && ref $client->tcpsock && $client->tcpsock) {
Slim::Networking::Slimproto::slimproto_close($client->tcpsock);
}
I actually wanted to suggest to further validate the socket object - exactly what you're doing there. The ref check is ok, but then test $client->tcpsock doesn't really add anything (but overhead 😀). I'd try to figure out what it's supposed to be: what class, object etc., then check whether the object received is what we expected.
The above is part of forgetClient, isn't it? Would your player often be forgotten?
Yes. That was going to be my next step --- check the type returned by 'ref', although I'm not 100% sure what it is supposed to be. Apparently it is returning an empty string becsuse it alwsys evaluates to False. forgetClient isn't called in normal circumstances. In my case, it is only called once --- the first time that the Chromecast Bridge registers this particular player after LMS is started, and it fails validation for some reason. When the registration is attempted again on retry some 30 seconds later, it works fine, as it does for all my other players. The only indication that there is any problem at all is the one error message in the log at LMS startup.
(And I will remove the value check, as suggested.)
Okay. After some more deep code diving, I think I've got the correct fix and will create a PR for it, although the question remains as to why the situation is occurring.
# Bug 15860: Force the connection shut if it is not already
if (defined $client->tcpsock && ref $client->tcpsock eq "IO::Socket::INET") {
Slim::Networking::Slimproto::slimproto_close($client->tcpsock);
}
@michaelherger I'm having problems with Github Desktop again, Michael, and it's driving me crazy. I am no longer able to push a commit to slimserver. Here is the screen that is displayed. I tried logging out and back in to Github both from my Windows PC and on the web site. Do you have any ideas? Maybe I should switch to the Windows app you are using. What is the name of it again?
I see you're trying to push to "upstream". In a typical setup this would fail, as you don't have direct push permissions to this repository. You'd typically have an "origin", which would be your personal fork. Then you'd push to your fork and submit a PR from there.
Thanks. I'll look into it in the morning.
I see you're trying to push to "upstream". In a typical setup this would fail, as you don't have direct push permissions to this repository. You'd typically have an "origin", which would be your personal fork. Then you'd push to your fork and submit a PR from there.
I'm at a total loss. The selected repository is "public/9.1". Which of those in the list should I be using? I feel like I should just delete everything and start over but don't see a way to do that either. All this for a simple 2-line change. Jeez!
I don't know if you did something behind the scenes or I just got lucky, but I was able to successfully commit my change using repository 'public/9.0'.
I would create a new branch "fix-selected-task-failed" or similar (basically a short description of what it does), push that new branch and submit the PR. Otherwise you might end up with a local version of an upstream branch which becomes out of sync with upstream.