Converting unnecessarily on sync

Beta Testing for Windows Products and plugins

Moderator: Gurus

Ludek
Posts: 5115
Joined: Fri Mar 09, 2007 9:00 am

Re: Converting unnecessarily on sync

Post by Ludek »

Hi,
I analyzed the log and I see:
GetDeviceLibrary: Serial Number 004aff24890ae265 match profile name: My Nexus 7 2013

But the SN 004aff24890ae265 is serial number of the Nexus4 (as can be seen on subsequent USB connection).
So the issue seems to be that the profile 'My Nexus 7 2013' was originally profile of Nexus4, but was somehow "renamed".
I am still searching how is it possible, but haven't found anything so far :-/

I guess that if you would delete both the profiles then things would start to work, but it doesn't tell us how they could be misidentified.

Nevertheless I see that in your test you deleted also MediaMonkey folder on the device, you shouldn't as it is where the StorageInfo.xml file is located (including the pairing key). If you have device for which MMA can't get Serial Number. Then deleting StorageInfo.xml and subsequent WiFi sync can create second profile (if you accept the dialog), because MMA regenerates new StorageInfo.xml with new pairing key that MMW cannot know until it is connected over USB.

Despite this I still don't see a situation that could exchange the profiles, searching further...
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Converting unnecessarily on sync

Post by rivorson »

I don't believe the profile was renamed. To test further I deleted both device profiles from MMW and started again. This time I did clear all of MMA's data again but then ran MMA once on each device so the database and StorageInfo.xml files were recreated before the test began. The result was the same.

Both device profiles were deleted in MMW 1668 non-debug before starting the test. I then installed the debug version.

Steps to produce this debug:

1. Clear all MMA data and launch MMA once on each device.

2. Launch DbgView and MMW 1668 debug.

3. Connect the tablet via USB. MMW creates a new 'Nexus 7' profile. Serial number: 08e9eb65.

Code: Select all

WMDM: Is Inserted: Nexus 7, 0:08e9eb65!USB
...
WMDM: It's a new device - adding
4. Add one playlist to the 'Nexus 7' sync list then disconnect the tablet.

5. Connect the phone via USB. MMW creates a new 'Nexus 4' profile. Serial number: 004aff24890ae265. Disconnect the phone without making any changes.

Code: Select all

WMDM: Is Inserted: Nexus 4, 0:004aff24890ae265!USB
...
WMDM: It's a new device - adding
6. Delete the 'Nexus 4' device profile.

7. Open MMA 175 on the tablet and initiate WiFi sync. MMW asks if I want to allow WiFi sync for the 'Nexus 7'. Files on the 'Nexus 7' sync list are downloaded and the sync completes successfully.

Code: Select all

GetDeviceLibrary: Wireless ID: 08e9eb65.0.22fc1019-73d5-4b0d-ad70-4f2cbd8b6ca8
GetDeviceLibrary: Wireless device found
GetDeviceLibrary: Profile found: Nexus 7
8. Open MMA 175 on the phone and initiate WiFi sync. MMW does not ask if I want to allow WiFi sync and proceeds straight to syncing the 'Nexus 7' file list.

Code: Select all

GetDeviceLibrary: Wireless ID: 004aff24890ae265.0.6980c2ae-c39f-46d2-a31b-385bd8c60bb5
GetDeviceLibrary: Wireless device found
GetDeviceLibrary: Profile found: Nexus 7
9. Connect the tablet via USB. MMW displays the 'Nexus 7' in the media tree. Disconnect the tablet.

Code: Select all

WMDM: Is Inserted: Nexus 7, 0:08e9eb65!USB
10. Connect the phone via USB. MMW creates a new 'Nexus 4' profile and displays that in the media tree.

Code: Select all

WMDM: Is Inserted: Nexus 4, 0:004aff24890ae265!USB
Debug log here:
https://www.dropbox.com/s/92vcaitr70kr4 ... cratch.log
Ludek
Posts: 5115
Joined: Fri Mar 09, 2007 9:00 am

Re: Converting unnecessarily on sync

Post by Ludek »

Thank you some much, we seem to got it!
You are great in debugging ;-)

The problem is that both device has same VID (vendor ID) and PID (product ID), therefore when MM search windows registry for serial number it does it based on VID and PID, but because they are same for both devices, it works with the same SN for both devices.

If you are interested, the info is stored within HKEY_LOCAL_MACHINE\System\CurrentControlSet\Enum\USB\<VID_PID>\<SerialNumber> , in your case it is
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Enum\USB\VID_18D1&PID_4EE1\<SerialNumber>

I am going to put it into Mantis and fix it tommorow.

EDIT: Tracked as http://www.ventismedia.com/mantis/view.php?id=11432
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Converting unnecessarily on sync

Post by rivorson »

Thanks, Ludek. I'm glad I was able to help.

I had a look at the registry key and both devices are listed there as well as my partner's phone, which is also a Nexus 4. Hopefully this discovery will prevent this issue from happening to any families that share their MM database and have the same phones.
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Converting unnecessarily on sync

Post by rivorson »

Hi Ludek

I've just tried this again on build 1669 and the problem still occurs. I followed the same steps as my previous post and again initiating wifi sync from the Nexus 4 after its profile had been deleted caused MMW to match the UPNP request with the Nexus 7's device profile. This also happens at random without having deleted the profile, but deleting the profile is the most reliable way to reproduce the problem for testing.

This time I got a little more detail from the log.

Upon initiating wifi sync from the Nexus 7:

Code: Select all

UPNP Server: File Request: /DeviceID=08e9eb65.0.8bea3bce-9774-4ee1-b96d-4fb986c2e119_DeviceName=Google Nexus 7 - Internal Storage_ItemID=DeviceConfig.xml , Range: < -1, -1>	
PostponeComputerSleep: Enabled = 1	
27408 DB open SQL: SELECT * FROM RemoteClients WHERE MAC = 'AC-22-0B-A2-EE-A0'  	
OpenQuery - Preparing query SELECT * FROM RemoteClients WHERE MAC = 'AC-22-0B-A2-EE-A0'  	
27408 DB lock finished, took 917.	
GetDeviceLibrary: Wireless ID: 08e9eb65.0.8bea3bce-9774-4ee1-b96d-4fb986c2e119	
GetDeviceLibrary: Wireless device found	
GetDeviceLibrary: Profile found: Nexus 7
Then upon initiating wifi sync from the Nexus 4:

Code: Select all

UPNP Server: File Request: /DeviceID=004aff24890ae265.0.e99c39c2-3c1f-4966-8d94-e2cfc3e11bc3_DeviceName=Google Nexus 4 - Internal Storage_ItemID=DeviceConfig.xml , Range: < -1, -1>	
PostponeComputerSleep: Enabled = 1	
18956 DB open SQL: SELECT * FROM RemoteClients WHERE MAC = 'E8-92-A4-9B-85-C8'  	
OpenQuery - Preparing query SELECT * FROM RemoteClients WHERE MAC = 'E8-92-A4-9B-85-C8'  	
18956 DB lock finished, took 1041.	
GetDeviceLibrary: Wireless ID: 004aff24890ae265.0.e99c39c2-3c1f-4966-8d94-e2cfc3e11bc3	
GetDeviceLibrary: Serial Number 004aff24890ae265 match profile name: Nexus 7	
Based on the log I wonder if the SQL query is the source of the problem, but I would expect it to return no results since this is effectively the first wifi sync connection for each device so that MAC addresses shouldn't be in the database.

Is it possible that there is a loop in the code storing each existing wireless ID in a variable to compare against the device requesting the connection, which does not clear its variable if the loop completes without a successful match?

Full debug log here:
https://www.dropbox.com/s/g2bhnz6djr7sz ... x%20up.log
Ludek
Posts: 5115
Joined: Fri Mar 09, 2007 9:00 am

Re: Converting unnecessarily on sync

Post by Ludek »

Hmm, problem is still in this:

Code: Select all

GetDeviceLibrary: Serial Number 004aff24890ae265 match profile name: Nexus 7 
004aff24890ae265 shouldn't match Nexus 7.

I will get back to you soon with new testing MM.EXE with more debug messages ...
Ludek
Posts: 5115
Joined: Fri Mar 09, 2007 9:00 am

Re: Converting unnecessarily on sync

Post by Ludek »

Hi, could you please replace your current MediaMonkey.exe from build 1669 by this one: www.happymonkeying.com/beta/MediaMonkey.exe and re-generate the log?
I added more debug messages that should definetly tell us why pairing based on SN still doesn't work on your side.

Thank you!
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Converting unnecessarily on sync

Post by rivorson »

I followed the same steps as previously to create the log with your exe. It looks like the critical moment is in matching against the USB registry keys as you first suspected.

Code: Select all

Searching SN 004aff24890ae265 within Windows registry, Nexus 7, VID_PID:VID_18D1&PID_4EE1, USB: 0:08e9eb65!USB@\\?\USB#VID_18D1&PID_4EE1#08e9eb65#{f33fdc04-d1ac-4e8e-9a30-19bbd4b108ae}$0

GetDeviceLibrary: Serial Number 004aff24890ae265 included within registry: Nexus 7, VID_PID:VID_18D1&PID_4EE1, USB: 0:08e9eb65!USB@\\?\USB#VID_18D1&PID_4EE1#08e9eb65#{f33fdc04-d1ac-4e8e-9a30-19bbd4b108ae}$0
Debug log here:
https://www.dropbox.com/s/33e98yzpwuxue ... ssages.log
Ludek
Posts: 5115
Joined: Fri Mar 09, 2007 9:00 am

Re: Converting unnecessarily on sync

Post by Ludek »

Thank you, will be fixed in 1670: http://www.ventismedia.com/mantis/view.php?id=11432
rivorson
Posts: 594
Joined: Thu Jul 25, 2013 4:17 am

Re: Converting unnecessarily on sync

Post by rivorson »

Thanks, Ludek. I can confirm that this is fixed in 1670. I tried it a few times slightly varying the order of creating and deleting profiles and I couldn't get the bug to occur. I even tried creating the device profiles with wifi sync to see if I could get the USB connections to use the wrong profile and MM worked perfectly every time.
Post Reply