Now playing showing wrong user

Need help? Post your questions here.

Moderator: moderators

Re: Now playing showing wrong user

Postby ytechie » Thu Jan 05, 2012 1:15 am

I have been doing some experiments if you will, and I would like to know about how often those experiencing problems purge players?

I have subsonic version 4.5 and I read that the newer versions delete old players. Can everyone experiencing problems share more info on the players? I know that deleting the player someone is using will change their playlist around because the playlist.jsp file updates the nowplaying service every so often.
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Now playing showing wrong user

Postby ytechie » Thu Jan 05, 2012 3:03 am

Great... In the process of replicating the identity instability on my subsonic instance, I caused instability even when I clear everything up. Terrific. :|
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Now playing showing wrong user

Postby ytechie » Thu Jan 05, 2012 3:44 am

Ok. I am led to believe that the cause of this issue is that in version 4.6, old players are deleted, but the associations that are used by other java 'services' are not.

There are many different files in the backend that have different functions. For example, there is a player service, a search service, a playlist service etc...

These all work together to carry out all of subsonic's functions.

I think the service or controller that creates the players is different than the service that figures out what's playing. (I looked at the source files.)

In 4.6, even if a player is deleted, it may not delete the records in the other services.

When subsonic cleans the players out in 4.6, the next time a user creates a new player, the id will be new to the player table, but not necessarily to the other services.

Now the big question is how to fix this issue without recompiling all the source code. :?
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Now playing showing wrong user - figured out

Postby ytechie » Thu Jan 12, 2012 4:35 am

I finally figured out why some people experience issues with the wrong user showing invalid information, and even scrobbling to the wrong user's last.fm account.

When a user changes players, a cookie is created that references that player. This way, when the user logs out and back in, that player is used if available.

Also, the info about each player only in regards to the now playing is kept separately from the other information in the database. In fact, it is not stored in the database at all! It is stored in java variables.

When a player is deleted or added, these java variables don't change.
When a player is created with an id that is not already in these variables, all of that player's information is added to the variables.
After that, the only information that will change for that id will be the currently playing song.

Even if a player is deleted, it still lives on in the java variables behind the scenes.

Here is why everyone is experiencing identity theft:

When a player that was used first by user 1 is deleted and recreated by user 2, the only data that will change in the java variables is the now playing info. The username will stay the same (because it was never deleted from these java variables; it was deleted from the player table in the database).

This means that when the now playing frame looks up what is currently playing, it is passed the old player info, with the new playing info.
When the scrobbler service asks what to scrobble and for what user, it is handed the original player's username, and the currently playing song.

So now many of you that are still with me may ask how this is possible if you deleted the players but restarted the system? (After a restart, the variables are reset.)

Well, I mentioned that each browser stores a cookie referencing the player last used.

Here is a scenario:

After a fresh restart, user A creates player 1, then the player is deleted, and the server is restarted.
After the restart, user B creates player 1 (because player 1 was deleted right before the restart).

Now, user A logs in to his account. The cookie tells the server to load player 1.
Now any song played by user A looks like it came from user B.

And with subsonic version 4.6, players are deleted automatically when they are deemed obsolete.

While I realize this is very detailed and very confusing, this is the only way I can explain it. Hope this clears up some confusion!

:shock:
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Now playing showing wrong user

Postby bushman4 » Thu Jan 12, 2012 3:13 pm

So, it looks like the solution is:

Delete all players
Tell all users to clear cookies
Restart subsonic
Cross fingers that all users did step 2.

Sounds like a quick line of code in Subsonic that does this would help:

check that the player that a user is requesting (because of a cookie) matches their username, and if not, create a new one and pass a new cookie to the client with that new number

Right?

Thanks for the detailed research...

Glenn
Glenn Sullivan
Subsonic 6.1.6 (Unraid Docker)
90 regular Subsonic Users

Library as of 2024-10-28:
4,527 artists
19,996 albums
282,151 songs
10201.40 GB
41,583 hours
User avatar
bushman4
 
Posts: 874
Joined: Thu Dec 02, 2010 1:47 pm
Location: Massachusetts, USA

Re: Now playing showing wrong user

Postby ytechie » Fri Jan 13, 2012 1:02 am

Glenn, you nailed it! That is exactly what subsonic needs. If Sindre coud pop that into the next release, it would solve a lot of issues. :D
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Now playing showing wrong user

Postby ytechie » Fri Jan 13, 2012 4:14 am

Also, I don't know if anyone noticed this, but if you name a player after using it at least once, until you restart the server, the player name won't be displayed correctly in the right frame (right as in right.jsp). Basically, the variables have to be better linked to the database, and all our problems would go away. :D

P.S. - I am in absolutely no way whatsoever saying that I think Sindre could have done a better job! I am not one of those. In my opinion, Subsonic is the best example of an open-source project that is done right. Sindre listens to everything we say, and works very hard to provide everyone with excellent software! Thank you Sindre.
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Re:

Postby mainadungo » Fri Jan 13, 2012 6:11 pm

mainadungo wrote:This fix worked for me also- although I had to do an extra step. Once I deleted all users, I had to log back on for the first time AS the person who is overpowering everybody else. Once I logged in as them first, it created a new player (player2), and showed an old deleted "phantom" player (player1) that was just cached or something. I deleted that initial one (player1) and kept the one that was created when I logged in just then (player2). Then I logged out and one by one logged in as my other 18 users (all from the server itself), and started a song for each (the process described in the post above mine). This caused players to be made for each person. This seems to have fixed the issue (for now?)

The interesting part, however- as soon as somebody logs in from a different computer/IP, it creates yet another play for them, so it's not even using the one the process above created for each person. So I'm not sure how this even helped, but the process seems to have jump started the creation of players- the act that wasn't taking place before, and thus causing this problem (I assume).

Can someobody else try this, and report back with results? It's not a bugfix, but a workaround for now.


Okay, this solution, while being valid and working for some time now, is beginning to fall apart. Same symptoms are coming back. My latest two user comments were "What the heck?! I'm Jason?" from Trishs, who was listening to Miles Davis, and "Why the heck is Miles Davis showing as scrobbled to my last.fm?!" from Jason.
mainadungo
 
Posts: 30
Joined: Thu Nov 06, 2008 6:10 pm

Re: Now playing showing wrong user

Postby ytechie » Fri Jan 13, 2012 6:20 pm

The problem is that the cookies still exist on other people's computers, which load players that now belong to other users.
Everyone must clear their cookies while logged out of subsonic.
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Now playing showing wrong user

Postby BKKKPewsey » Fri Jan 13, 2012 8:01 pm

Again a bit above my pay grade this discussion is but wouldn't
Code: Select all
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

In the <head> work?
Everyone is entitled to be stupid, Image but some abuse the privilege!

Due to the confusion from too many genres of music, we have decided to put both country music and rap music into the genre of Crap music.
User avatar
BKKKPewsey
 
Posts: 2080
Joined: Mon May 23, 2011 12:16 pm
Location: United Kingdom

Re: Now playing showing wrong user

Postby ytechie » Fri Jan 13, 2012 8:06 pm

No it wouldn't. The issue is in a lot of places, but one of them has to do with a cookie. So why not disable cookies from the site? Even if you did that on all users' computers, you would still need the cookies for the session id.

The problem needs to be fixed in the java backend. I've tried lots of things, and looked at lots of open-source code. No solution. Yet.
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Now playing showing wrong user

Postby ytechie » Sun Jan 22, 2012 11:47 pm

If anyone is still experiencing problems with identity mismatches, I developed a method of checking the cookie for it's validity and if necessary, removing it and clearing things up. It might take a while to post though, so I would like to know if anyone is interested. I will be glad to share if people ask.

:D
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Now playing showing wrong user

Postby mainadungo » Wed Feb 22, 2012 4:42 pm

If you get this working, PLEASE share!

Although it's been almost a month without the issue, since I did my fix posted above.
mainadungo
 
Posts: 30
Joined: Thu Nov 06, 2008 6:10 pm

Re: Now playing showing wrong user

Postby ytechie » Wed Feb 22, 2012 5:21 pm

I completely forgot about this. I have a way of checking that has completely eliminated this problem for me. It is quite extensive though.
User avatar
ytechie
 
Posts: 547
Joined: Sun Dec 12, 2010 5:05 am
Location: Manhattan, New York

Re: Now playing showing wrong user

Postby BKKKPewsey » Wed Feb 22, 2012 5:32 pm

From Sindre's TODO list
DONE IN 4.7
Bugfix: Fixed problem with players being associated to wrong users.

Just need to wait a little longer :)

(Mind you the list for items still to done is still very long :roll: )
Everyone is entitled to be stupid, Image but some abuse the privilege!

Due to the confusion from too many genres of music, we have decided to put both country music and rap music into the genre of Crap music.
User avatar
BKKKPewsey
 
Posts: 2080
Joined: Mon May 23, 2011 12:16 pm
Location: United Kingdom

Previous

Return to Help

Who is online

Users browsing this forum: No registered users and 18 guests