1473: TerminateThreads does not finish cleanly [#9229]

MediaMonkey 4.1 beta testing is now underway...

Moderator: Gurus

1473: TerminateThreads does not finish cleanly [#9229]

Postby markstuartwalker » Thu Feb 16, 2012 10:16 am

This is an old issue from viewtopic.php?f=6&t=61763&p=317810&hilit=terminatethreads#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.
Windows 7 SP1 x64 / Ubuntu 11.10 / Lion 10.7.3 / iOS 5.1 / iTunes 10.6.0
iTunes plugin (d_itunes & itunes4) viewtopic.php?f=2&t=45713
Running MM under Mac OS X with Wine viewtopic.php?f=4&t=58507
markstuartwalker
 
Posts: 868
Joined: Fri Jul 10, 2009 8:10 am

Re: 1473: TerminateThreads does not finish cleanly

Postby Ludek » Thu Mar 22, 2012 11:11 am

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.
Ludek
 
Posts: 1425
Joined: Fri Mar 09, 2007 9:00 am

Re: 1473: TerminateThreads does not finish cleanly

Postby Ludek » Thu Mar 22, 2012 11:18 am

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

Re: 1473: TerminateThreads does not finish cleanly

Postby markstuartwalker » Mon Mar 26, 2012 2:51 am

When might I get visibility of this release for testing?
Windows 7 SP1 x64 / Ubuntu 11.10 / Lion 10.7.3 / iOS 5.1 / iTunes 10.6.0
iTunes plugin (d_itunes & itunes4) viewtopic.php?f=2&t=45713
Running MM under Mac OS X with Wine viewtopic.php?f=4&t=58507
markstuartwalker
 
Posts: 868
Joined: Fri Jul 10, 2009 8:10 am

Re: 1473: TerminateThreads does not finish cleanly

Postby markstuartwalker » Fri Apr 13, 2012 10:16 am

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.
Windows 7 SP1 x64 / Ubuntu 11.10 / Lion 10.7.3 / iOS 5.1 / iTunes 10.6.0
iTunes plugin (d_itunes & itunes4) viewtopic.php?f=2&t=45713
Running MM under Mac OS X with Wine viewtopic.php?f=4&t=58507
markstuartwalker
 
Posts: 868
Joined: Fri Jul 10, 2009 8:10 am

Re: 1473: TerminateThreads does not finish cleanly

Postby rusty » Fri Apr 27, 2012 8:52 am

Hi Mark,

Can you confirm that this is working for you as expected in build 1484?

Thanks.

-Rusty
rusty
 
Posts: 5335
Joined: Tue Apr 29, 2003 3:39 am
Location: Montreal, Canada

Re: 1473: TerminateThreads does not finish cleanly

Postby markstuartwalker » Fri May 04, 2012 1:57 am

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.
Windows 7 SP1 x64 / Ubuntu 11.10 / Lion 10.7.3 / iOS 5.1 / iTunes 10.6.0
iTunes plugin (d_itunes & itunes4) viewtopic.php?f=2&t=45713
Running MM under Mac OS X with Wine viewtopic.php?f=4&t=58507
markstuartwalker
 
Posts: 868
Joined: Fri Jul 10, 2009 8:10 am

Re: 1473: TerminateThreads does not finish cleanly

Postby Ludek » Mon May 07, 2012 5:47 pm

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.
Ludek
 
Posts: 1425
Joined: Fri Mar 09, 2007 9:00 am

Re: 1473: TerminateThreads does not finish cleanly [#9229]

Postby markstuartwalker » Tue May 08, 2012 11:40 am

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
Windows 7 SP1 x64 / Ubuntu 11.10 / Lion 10.7.3 / iOS 5.1 / iTunes 10.6.0
iTunes plugin (d_itunes & itunes4) viewtopic.php?f=2&t=45713
Running MM under Mac OS X with Wine viewtopic.php?f=4&t=58507
markstuartwalker
 
Posts: 868
Joined: Fri Jul 10, 2009 8:10 am

Re: 1473: TerminateThreads does not finish cleanly [#9229]

Postby Ludek » Tue May 08, 2012 5:58 pm

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


Aha then, that was really misunderstanding.

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.
Ludek
 
Posts: 1425
Joined: Fri Mar 09, 2007 9:00 am

Re: 1473: TerminateThreads does not finish cleanly [#9229]

Postby markstuartwalker » Thu May 10, 2012 11:35 am

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.
Windows 7 SP1 x64 / Ubuntu 11.10 / Lion 10.7.3 / iOS 5.1 / iTunes 10.6.0
iTunes plugin (d_itunes & itunes4) viewtopic.php?f=2&t=45713
Running MM under Mac OS X with Wine viewtopic.php?f=4&t=58507
markstuartwalker
 
Posts: 868
Joined: Fri Jul 10, 2009 8:10 am

Re: 1473: TerminateThreads does not finish cleanly [#9229]

Postby markstuartwalker » Sat May 12, 2012 3:26 am

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.
Windows 7 SP1 x64 / Ubuntu 11.10 / Lion 10.7.3 / iOS 5.1 / iTunes 10.6.0
iTunes plugin (d_itunes & itunes4) viewtopic.php?f=2&t=45713
Running MM under Mac OS X with Wine viewtopic.php?f=4&t=58507
markstuartwalker
 
Posts: 868
Joined: Fri Jul 10, 2009 8:10 am


Return to MediaMonkey for Windows Beta Testing

Who is online

Users browsing this forum: No registered users and 15 guests