1473: TerminateThreads does not finish cleanly [#9229]
Moderator: Gurus
-
- Posts: 931
- Joined: Fri Jul 10, 2009 8:10 am
1473: TerminateThreads does not finish cleanly [#9229]
This is an old issue from http://www.mediamonkey.com/forum/viewto ... ds#p317810
I thought that I'd covered this off already but recent testing in another area I revealed that it does terminate but it leaves the current message on the status bar.
For example, if I call this from within DEVICE_GetFlag via the dflFullSynchStart constant it leaves the message "Synchronising d_itunes4.dll on xxxxx: (preparing list of files)". Terminating the thread ought to clear the message too.
In Delphi I can see a repeating message "Waiting for SyncroniseDevice thread to terminate" message. Further, if MM is closed in this state it says that there are background tasks running.
... or perhaps we ought to terminate device synchronisation more cleanly than just killing the tasks.
I thought that I'd covered this off already but recent testing in another area I revealed that it does terminate but it leaves the current message on the status bar.
For example, if I call this from within DEVICE_GetFlag via the dflFullSynchStart constant it leaves the message "Synchronising d_itunes4.dll on xxxxx: (preparing list of files)". Terminating the thread ought to clear the message too.
In Delphi I can see a repeating message "Waiting for SyncroniseDevice thread to terminate" message. Further, if MM is closed in this state it says that there are background tasks running.
... or perhaps we ought to terminate device synchronisation more cleanly than just killing the tasks.
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
Re: 1473: TerminateThreads does not finish cleanly
You seem to be true that MediaMonkey should check more often whether the thread is about to be terminated and to terminate it ASAP.
I will fix it.
I will fix it.
-
- Posts: 931
- Joined: Fri Jul 10, 2009 8:10 am
Re: 1473: TerminateThreads does not finish cleanly
When might I get visibility of this release for testing?
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
-
- Posts: 931
- Joined: Fri Jul 10, 2009 8:10 am
Re: 1473: TerminateThreads does not finish cleanly
I've checked build 4.0.5.1481. I have a slightly modified test case that doesn't work.
* Sync 20 tracks.
* Change the auto sync list so only 10 tracks will remain.
* Sync and see the "10/20 of the tracks are to be deleted. Continue to delete?" message appearing.
* Select "No"
This causes the TerminateThreads function to be called from within the DEVICE_DeleteFiles() function. Result is that the "Removing old content" message remains forever.
When finally MM is manually closed it says that there are background tasks running.
* Sync 20 tracks.
* Change the auto sync list so only 10 tracks will remain.
* Sync and see the "10/20 of the tracks are to be deleted. Continue to delete?" message appearing.
* Select "No"
This causes the TerminateThreads function to be called from within the DEVICE_DeleteFiles() function. Result is that the "Removing old content" message remains forever.
When finally MM is manually closed it says that there are background tasks running.
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
Re: 1473: TerminateThreads does not finish cleanly
Hi Mark,
Can you confirm that this is working for you as expected in build 1484?
Thanks.
-Rusty
Can you confirm that this is working for you as expected in build 1484?
Thanks.
-Rusty
-
- Posts: 931
- Joined: Fri Jul 10, 2009 8:10 am
Re: 1473: TerminateThreads does not finish cleanly
Sorry for the delay. I've tested with 1486. The problem is still there.
The sync message remains on screen. When closing MM it says there are background tasks. Need to forcibly close using Task Manager.
The sync message remains on screen. When closing MM it says there are background tasks. Need to forcibly close using Task Manager.
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
Re: 1473: TerminateThreads does not finish cleanly
markstuartwalker wrote:Sorry for the delay. I've tested with 1486. The problem is still there.
The sync message remains on screen. When closing MM it says there are background tasks. Need to forcibly close using Task Manager.
Mark, strange, I can no longer replicate anything like this after the fix.
Maybe there is a misunderstanding, do we both think the "Delete from device" dialog saying:
"The following X items on youre device ...... Do you want to remove them from the device?" and there are buttons
[Continue] [Cancel]
you click [Cancel] and are you saying that the problem described by you appears?
It shouldn't get into DEVICE_DeleteFiles if you clicked [Cancel], so you clicked [Continue]?
And even if I click [Continue] and put TerminateThreads() into the DEVICE_DeleteFiles() I can no longer reproduce the issue in 1486.
Please re-test or send me your plugin to reproduce.
-
- Posts: 931
- Joined: Fri Jul 10, 2009 8:10 am
Re: 1473: TerminateThreads does not finish cleanly [#9229]
Misunderstanding. My plugin has an addition check for more than 5% of the files being deleted. It's dialogue is what I refer to and not the mm one.
Plugin can be downloaded from the mm site
Plugin can be downloaded from the mm site
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
Re: 1473: TerminateThreads does not finish cleanly [#9229]
Aha then, that was really misunderstanding.markstuartwalker wrote:Misunderstanding. My plugin has an addition check for more than 5% of the files being deleted. It's dialogue is what I refer to and not the mm one.
Plugin can be downloaded from the mm site
The deadlock here was caused by the fact that you called TSDBDevice.TerminateThreads() function from the thread that was about to terminate, and there was waiting for the termination in the TSDBDevice.TerminateThreads()
I removed the waiting from the TSDBDevice.TerminateThreads() function, will be fixed in build 1489.
-
- Posts: 931
- Joined: Fri Jul 10, 2009 8:10 am
Re: 1473: TerminateThreads does not finish cleanly [#9229]
Ok. ALL of my code runs under the sync so I thought that was pretty obvious. I described this as a suicide call.
I look forward to the next release.
I look forward to the next release.
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
-
- Posts: 931
- Joined: Fri Jul 10, 2009 8:10 am
Re: 1473: TerminateThreads does not finish cleanly [#9229]
Tested MM 4.0.5.1489 and this seems to fix the problems.
The sync message is removed immediately, the sync can be re-attempted and if MM closes it no longer reports that there are background running tasks.
Thank you.

Thank you.
Windows 7,8 / Ubuntu 13.10 / Mavericks 10.9 / iOS 7.1 / iTunes 11.1
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507
iTunes plugin (d_itunes & itunes4) http://www.mediamonkey.com/forum/viewto ... =2&t=45713
Running MM under Mac OS X with Wine http://www.mediamonkey.com/forum/viewto ... =4&t=58507