Converting unnecessarily on sync

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Converting unnecessarily on sync

Re: Converting unnecessarily on sync

by rivorson » Sat Nov 09, 2013 9:57 am

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.

Re: Converting unnecessarily on sync

by Ludek » Mon Nov 04, 2013 11:17 am

Thank you, will be fixed in 1670: http://www.ventismedia.com/mantis/view.php?id=11432

Re: Converting unnecessarily on sync

by rivorson » Mon Nov 04, 2013 9:50 am

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

Re: Converting unnecessarily on sync

by Ludek » Mon Nov 04, 2013 9:02 am

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!

Re: Converting unnecessarily on sync

by Ludek » Mon Nov 04, 2013 5:47 am

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 ...

Re: Converting unnecessarily on sync

by rivorson » Fri Nov 01, 2013 8:08 pm

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

Re: Converting unnecessarily on sync

by rivorson » Tue Oct 29, 2013 6:07 pm

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.

Re: Converting unnecessarily on sync

by Ludek » Tue Oct 29, 2013 5:22 pm

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

Re: Converting unnecessarily on sync

by rivorson » Tue Oct 29, 2013 5:01 pm

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

Re: Converting unnecessarily on sync

by Ludek » Tue Oct 29, 2013 3:54 pm

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...

Re: Converting unnecessarily on sync

by rivorson » Tue Oct 29, 2013 1:35 pm

Ludek wrote: If you connect your Nexus7 via USB, is it correctly recognized as Nexus7 or Nexus4 and vice versa?
When I did this a few days ago each device was identified correctly when connected by USB. The phone's profile had been deleted and I connected the tablet first, which was identified correctly as the tablet, then I connected the phone which correctly created the new profile for the phone.
I have just tried this again while creating the debug logs but this time I connected the phone first and it was identified erroneously as the tablet. Then I connected the tablet which was not identified with the existing profile so MM created a duplicate profile for the tablet.
Basically, whichever device is connected by USB first becomes linked to the existing device profile, but each device will use the existing profile for WiFi sync if it is not connected by USB at some point.

Here are the steps I took to create the debug logs:

1. Delete all content from the phone so that it would appear as a new device, including music already on the device, the MediaMonkey directory, db_debug.trace, and SyncListQuery.trace.

2. Launch DbgView.

3. Launch MMW build 1668 debug version.

4. In the MMW Options, delete the 'My Nexus 4' phone profile.

5. Open MMA build 175 and launch initiate WiFi sync.

The sync then proceeds without MMW asking to allow the new device. The tracks and playlists downloaded are those on the tablet's sync list.
From the debug log, the WiFi sync matched the UPnP request with the existing tablet profile named 'My Nexus 7 2013'.
After the sync completed I submitted debug log 249BWAARGZ from MMA.

6. Connect the phone via USB. MMW identifies it as 'My Nexus 7 2013'.

7. Disconnect the phone and then connect the tablet via USB which is identified as a new device and given the name 'Nexus 7'.


The DbgView log can be found here:
https://www.dropbox.com/s/ii86upxsze8fg ... rofile.LOG

Re: Converting unnecessarily on sync

by Ludek » Tue Oct 29, 2013 11:34 am

rivorson wrote: It seems that when one device profile is deleted the key may not be completely removed from the database and somehow ends up pointing to another profile.
This should not happen, but previous analyze shown that the key of Nexus7 got to the profile of Nexus4. The question was how is that possible?
My only idea is that it got there somehow on USB connection. If you connect your Nexus7 via USB, is it correctly recognized as Nexus7 or Nexus4 and vice versa? Could you generate debug log using DbgView (item 4b here: http://www.mediamonkey.com/forum/viewto ... ?f=6&t=341 ) while connecting your Nexus7/Nexus4 via USB?

EDIT: Before this it would be probably more usable to catch in the debug log what you have described,
i.e. delete the phone's device profile then immediately attempts a wifi sync from the phone

Thank you for helping us to debug this.

Re: Converting unnecessarily on sync

by rivorson » Thu Oct 24, 2013 1:55 pm

I think I have made some progress in discovering the cause of this problem. I had previously fixed it by deleting both device profiles and recreating them. Today I deleted the phone's device profile then immediately attempted a wifi sync from the phone. Instead of creating a new device profile it used the tablet's profile and sync list.

It seems that when one device profile is deleted the key may not be completely removed from the database and somehow ends up pointing to another profile.

Re: Converting unnecessarily on sync

by Ludek » Thu Oct 03, 2013 5:22 pm

No, the key is not included when importing the device profile from MMDC.

In the log I see that Nexus4 is paired by Serial Number during WiFi sync, therefore it works.

So the question is how could the key of Nexus7 got to the profile of Nexus4.

Anyhow I should probably check content of the StorageInfo.xml file on each USB connection and sync the keys. Currently I do it only on initial sync, but the key might change e.g. when SD cards are switched etc. I will fix it.

Re: Converting unnecessarily on sync

by rivorson » Wed Oct 02, 2013 2:53 pm

Nexus phones and tablets don't have SD card slots, so I can only use the internal storage.

I have created a debug log capturing the events of syncing the phone and subsequently syncing the tablet. It can be accessed using the link in my previous post.

Is the device key included when importing a device profile? If so, this may be the cause of the problem. When I am setting up a new Android device I usually export the profile of an existing device and import it on the new device. There are three Nexus 4 phones and three Nexus 7 tablets in my family, so importing existing profiles saves a lot of time when setting up devices.

Top