Bug 3956 - CLI player preference queries are flapping
: CLI player preference queries are flapping
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: CLI
: 6.5b1
: PC Windows XP
: P2 normal (vote)
: ---
Assigned To: Chris Owens
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-08-17 14:15 UTC by dmc
Modified: 2008-09-15 14:39 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dmc 2006-08-17 14:15:02 UTC
Using CLI port 9090, querying player preferences works every second time.
I tried using two different player preferences, same result.
Tried restarting slimserver, no change.

Example : mp3SilencePrelude
  livingroom playerpref mp3SilencePrelude ?
  00%3A04%3A20%3A06%3A13%3Ab5 playerpref mp3SilencePrelude 0

  livingroom playerpref mp3SilencePrelude ?
  livingroom playerpref mp3SilencePrelude %3F

  livingroom playerpref mp3SilencePrelude ?
  00%3A04%3A20%3A06%3A13%3Ab5 playerpref mp3SilencePrelude 0

  livingroom playerpref mp3SilencePrelude ?
  livingroom playerpref mp3SilencePrelude %3F


The same behaviour was seen for playingDisplayMode, with %3F seen 
every second attempt.
Comment 1 dmc 2006-08-17 14:23:36 UTC
I think this was the 16 August nightly...
SlimServer Version: 6.5b1 - 8984 - Windows XP - EN - cp1252
Comment 2 Chris Owens 2006-08-18 12:41:32 UTC
Fred does this ring any bells for you?
Comment 3 Fred 2006-08-18 15:21:16 UTC
The problem is the "livingroom" part, not the playerpref query. Please check using the mac id of the player (as described in the CLI doc) and it should work every time.

Now an undocumented feature of the CLI is to try and use the first word in the query as a player identifier. But there is a bug. Enabling d_cli:

2006-08-18 23:50:55.8278 CLI: 127.0.0.1:52749 - Buffered [soft3 playerpref mp3SilencePrelude ?]
2006-08-18 23:50:55.8321 CLI: Parsing command: Found client [0c:7c:79:37:9c:c3]
2006-08-18 23:50:55.8344 CLI: Processing request [playerpref]
2006-08-18 23:50:55.9093 CLI: Dispatching [playerpref]
2006-08-18 23:50:55.9192 CLI: 127.0.0.1:52749 - Sending response [0c%3A7c%3A79%3A37%3A9c%3Ac3 playerpref mp3SilencePrelude 0...]
2006-08-18 23:50:55.9209 CLI: Sent response to 127.0.0.1:52749

2006-08-18 23:51:00.6183 CLI: 127.0.0.1:52749 - Buffered [soft3 playerpref mp3SilencePrelude ?]
2006-08-18 23:51:00.6483 CLI: Processing request [soft3]
2006-08-18 23:51:00.6496 CLI: Request [soft3] unkown or missing client -- will echo as is...
2006-08-18 23:51:00.6860 CLI: 127.0.0.1:52749 - Sending response [soft3 playerpref mp3SilencePrelude %3F...]
2006-08-18 23:51:00.6893 CLI: Sent response to 127.0.0.1:52749

Same query, 5 second interval, once soft3 is found to be 0c:7c:79:37:9c:c3, the next time it is not found.

The routine called is Slim::Player::Client::getClient:

sub getClient {
	my $id  = shift || return undef;
	
	msg(sprintf("getClient(%s)\n", $id));
	
	my $ret = $clientHash{$id};
	
	msg("found in clientHash\n") if defined $ret;
    
	
	# Try a brute for match for the client.
	if (!defined($ret)) {
		msg("not found in clientHash, iterating over it...\n");
		while (my ($key, $value) = each(%clientHash)) {
		
			msg(sprintf("%s eq %s ?\n", ipport($value), $id));
			return $value if (ipport($value) eq $id);
			msg(sprintf("%s eq %s ?\n", ip($value), $id));
			return $value if (ip($value) eq $id);
			msg(sprintf("%s eq %s ?\n", name($value), $id));
			return $value if (name($value) eq $id);
		}
	}
	msg("done\n");
	return($ret);
}

For some reason I cannot understand, sometimes each(%clientHash) does not work!

2006-08-19 00:15:50.5003 getClient(soft3)
2006-08-19 00:15:50.5023 not found in clientHash, iterating over it...
2006-08-19 00:15:50.5218 192.168.1.3:53151 eq soft3 ?
2006-08-19 00:15:50.5232 192.168.1.3 eq soft3 ?
2006-08-19 00:15:50.5251 soft3 eq soft3 ?

2006-08-19 00:15:51.3781 getClient(soft3)
2006-08-19 00:15:51.3799 not found in clientHash, iterating over it...
2006-08-19 00:15:51.3805 done

???






Comment 4 KDF 2006-08-18 15:58:55 UTC
if you rework is as a for loop, is it still skipping?
Comment 5 Fred 2006-08-18 16:25:00 UTC
	if (!defined($ret)) {
   		 for my $value ( values %clientHash ) {
			return $value if (ipport($value) eq $id);

seems to work, but why the other isn't is puzzling me.

Comitted in 9046, mentioning the issue fixed in the Changlelog.