View Issue Details

IDProjectCategoryView StatusLast Update
0014820MMW v4Otherpublic2018-07-10 09:19
ReporterLudek Assigned To 
PriorityimmediateSeveritymajorReproducibilityhave not tried
Status closedResolutionreopened 
Product Version4.1.21 
Target Version4.1.21Fixed in Version4.1.21 
Summary0014820: Loading time is 60 seconds when Real time protection is active (Windows Defender)
DescriptionUsers are reporting that RealTime Protection (Windows Defender) causes that MM4 loading time is 60 seconds: http://www.mediamonkey.com/forum/viewtopic.php?f=6&t=89731 , MM5 isn't affected.
TagsNo tags attached.
Fixed in build1868

Relationships

related to 0014898 closedLudek Startup issues with some specific scripts/addons (regression 4.1.21) 
related to 0014957 feedback Slow startup because of the MatchCollection object 

Activities

Ludek

2018-05-11 10:55

developer   ~0050255

Last edited: 2018-05-11 17:45

Peke, could you please test whether you can replicate? I have tried and cannot replicate. Start takes 4 seconds on low power Win10 laptop. We could try to report the issue to Windows Defender? Also KB article chould be added/updated until we have more info?

I am asking users for debug logs meanwhile (to see whether this is fixable by us).

Ludek

2018-05-14 11:10

developer   ~0050283

Last edited: 2018-05-14 11:26

Based on user log the issue seems related to scripting:
http://www.mediamonkey.com/forum/viewtopic.php?f=6&t=89731&p=445085#p445085

I've tried to replicate myself on low power laptop (HP core i3) and after all the Win10 upgrades the first start of MM really takes a long time (13 seconds here), but any subsequent start takes just 3 seconds.
Asking more info via ticket/forum...

Ludek

2018-05-15 08:31

developer   ~0050304

Last edited: 2018-05-15 12:14

User confirmed that renaming user scripts folder solves the slow start, to be found which script is causing this... (RDS-991-90091)

EDIT: It is caused by this script: RegExp Find & Replace 4.3. http://www.mediamonkey.com/forum/viewtopic.php?f=2&t=28510
Uninstalling it backs to normal startup behaviour.

Ludek

2018-05-15 13:39

developer   ~0050307

I installed "RegExp Find & Replace 4.3" and can confirm the issue now. MM starts 2 minutes!! on my low power laptop (HP core i3).
It seems that "RegExp Find & Replace 4.3" has many presets (> 250) that are all added as menu items on startup and for each item I see:
TEventedAutoObject Created, Class: TSDBMenuItem
in the log. i.e. Windows Defender seems to check each OLE object on its creation causing the slowdowns.
I am going to find whether it can be somehow eliminated (otherwise the script would have to be modified).

Ludek

2018-05-15 17:22

developer   ~0050309

Last edited: 2018-05-15 17:36

I've been debugging this and when the real time protection in Windows Deffender is active then there is a delay between oleaut32.DispCallFunc callbacks
e.g. it is without a delay 10 times and between 11th and 12th call of DispCallFunc there is 0.2 seconds delay. And because this callback is called for each TSDBMenuItem more than 255 items on startup it results in the startup slowdowns.

The solutions that I see now is either:
- to be fixed by MS in Windows Defender
- modify "RegExp Find & Replace 4.3" script to not create all the menu items on startup, but either create them on demand (or not create them at all)? Suggested to author at http://www.mediamonkey.com/forum/viewtopic.php?f=2&t=28510&start=1455#p445137

Ludek

2018-05-16 14:22

developer   ~0050319

I've resolved this issue by moving initialization of startup scripts to a post run action (non-blocking UI thread) in build 1867.
This way MM can be used immediately after startup, but some scripts (that takes long time to init) may not be fully initialized yet. This may also result in some bugs when MM is closed during (or before) script init, to be tested/reviewed by scripters.

"RegExp Find & Replace" long init issues discussed at: http://www.mediamonkey.com/forum/viewtopic.php?f=2&t=28510&start=1455#p445137

Ludek

2018-05-22 14:54

developer   ~0050338

Also reported to MS: https://answers.microsoft.com/en-us/protect/forum/protect_defender-protect_scanning-windows_10/last-update-of-windows-defender-causes-terribly/c71cc133-5c5f-447e-95fb-e2641085836d?tm=1527000700529

zvezdan

2018-05-23 14:54

updater   ~0050347

I have got a report from one user that this new update doesn't help too much with Magic Nodes: "Startup is 1.5 seconds, after that MediaMonkey freezes for 48 seconds". So, I suggest that you revert the old behavior because maybe this approach introduced in 1867 could lead to some another incompatibility with the existing scripts.

By the way, I worked on my own workaround for RegExp Find & Replace script and I found the solution. I though at first that the problem is with the Dictionary object that I am using in RegExp script during startup extensively, but it turned out that it is a problem with the MatchCollection object returned by the RegExp.Execute method which is a collection of Match objects. As you can guess, I have used this object during startup extensively as well, but I found a workaround to eliminate its use (at least during startup).

However, I am afraid I cannot use the same workaround for Magic Nodes because its regular expressions that I am using for parsing of MN's masks are much complicated than those used in RegExp script. I will see about it when I find a time.

Ludek

2018-05-24 07:23

developer   ~0050349

Last edited: 2018-05-24 07:27

I tested with default install of the last version of Magic Nodes script and the scripts seem to add "only" 100 menu items during start which takes just 1.2 seconds after start. RegExp Find & Replace script adds 255 items and takes 60 seconds, not sure why the difference. For this script my workaround works as MM 1867 starts and is usable while "RegExp Find & Replace" is loading on background for 60 seconds.

I guess my workaround is needed until either:
a) Microsoft fixes the regression in Windows Defender
b) User gets updated scripts

Actually I probably should add a progress bar after MM start indicating something like "Loading Magic Nodes Script..." so that users are aware what is happening.

Note that even previously (without the Windows Defender update) it took more that 1 second to load the "RegExp Find & Replace" script, i.e. it postponed startup and took 4 seconds instead of 3 seconds -- so I guess that loading the scripts nearly after startup (instead of during startup) still makes sense.

Ludek

2018-05-24 13:11

developer   ~0050354

Last edited: 2018-05-31 10:51

The loading progress added in 1868.

+ fixed: Selected magic node not restored after restart (regression)

Ludek

2018-05-31 10:56

developer   ~0050444

Last edited: 2018-05-31 13:22

Re-opened: Users are reporting AVs with some scripts with 1867 (Advanced duplicate find & fix, MegaDJ, MiniLyrics, MiniLyrics Embedded):
http://www.mediamonkey.com/forum/viewtopic.php?f=6&t=89945
http://mediamonkey.com/forum/viewtopic.php?f=6&t=89857

Fixed in 1868

Test note: App is started and auto scripts are loading within main UI thread again (blocking UI thread until the script is _fully_ loaded as whole), BUT with progress bar indicating which script is loading.
So user can see "Loading... RegExpReplace.vbs" and is aware of which script is causing the startup issue.

peke

2018-05-31 20:43

developer   ~0050463

Verified 1868