Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin program query cost too much time #1017

Closed
jhdxr opened this issue Oct 13, 2016 · 25 comments
Closed

plugin program query cost too much time #1017

jhdxr opened this issue Oct 13, 2016 · 25 comments
Labels

Comments

@jhdxr
Copy link
Member

jhdxr commented Oct 13, 2016

  1. Wox version / commit number: 1.3.295
  2. Steps to reproduce the bug:
    install wox, query anything (not first query, reindex doesn't work). there is no results for quite long time. and the stat in plugin panel tells me the query time for program is 26104ms. (1.3.231 works fine)
  3. Windows version: win10 x64 (10586)
  4. Exception: none
  5. whole log file (%APPDATA%\Wox\Logs\version\date.txt):
2016-10-14 02:23:58.7257|INFO|Wox.Plugin.Program.Main..ctor|Preload 0 programs from cache
2016-10-14 02:24:01.0289|ERROR|Wox.App+<>c.<RegisterAppDomainExceptions>b__13_0|First Chance Exception:
2016-10-14 02:24:01.0289|ERROR|Shell.IShellLinkW.Resolve|Value does not fall within the expected range.
2016-10-14 02:24:01.0289|ERROR|Shell.IShellLinkW.Resolve|
   at Shell.IShellLinkW.Resolve(_RemotableHandle& hwnd, UInt32 fFlags)
   at Wox.Plugin.Program.Programs.Win32.LnkProgram(String path) in C:\projects\wox\Plugins\Wox.Plugin.Program\Programs\Win32.cs:line 147
2016-10-14 02:24:01.0289|ERROR|Wox.Plugin.Program.Programs.Win32.LnkProgram|Error when parsing shortcut: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Desktop.lnk
2016-10-14 02:24:01.7313|ERROR|Wox.Core.Plugin.PluginsLoader.PythonPlugins|Python can't be found in PATH.
2016-10-14 02:24:01.7313|ERROR|Wox.Core.Plugin.PluginsLoader.PythonPlugins|

2016-10-14 02:24:02.2961|INFO|Wox.App.<OnStartup>b__8_0|Preload 200 images from cache
2016-10-14 02:25:32.4600|ERROR|Wox.App+<>c.<RegisterAppDomainExceptions>b__13_0|First Chance Exception:
2016-10-14 02:25:32.4660|ERROR|Shell.IShellLinkW.Resolve|Value does not fall within the expected range.
2016-10-14 02:25:32.4660|ERROR|Shell.IShellLinkW.Resolve|
   at Shell.IShellLinkW.Resolve(_RemotableHandle& hwnd, UInt32 fFlags)
   at Wox.Plugin.Program.Programs.Win32.LnkProgram(String path) in C:\projects\wox\Plugins\Wox.Plugin.Program\Programs\Win32.cs:line 147
2016-10-14 02:25:32.4660|ERROR|Wox.Plugin.Program.Programs.Win32.LnkProgram|Error when parsing shortcut: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Desktop.lnk
@lances101 lances101 added the bug label Oct 18, 2016
@lances101
Copy link
Member

Wow. 26 seconds is a really long time. Must be related to Metro Apps since it was not present before. I will try to profile the plugin this weekend.

@jhdxr
Copy link
Member Author

jhdxr commented Nov 8, 2016

hello @lances101 , how's the profiler going?

@lances101
Copy link
Member

@jhdxr to be honest not very well. I started working and still am finishing my master so it's a little bit hard to dedicate a lot of time to Wox. I decided to spend this afternoon answering tickets and trying to fix problems that can be fixed in an evening. My main priority in terms of Wox development is releasing 1.3.295 through Squirrel. That build is way more stable than 1.3.183.

The 26 seconds delay is a huge issue, so it will have a high priority.

@jhdxr jhdxr mentioned this issue Nov 15, 2016
@lances101
Copy link
Member

@jhdxr
As a quick fix I can add an option to disable Win 10 application indexing from the settings window.

I will install Windows 10 this week and take a look. The API @happlebao used is only available with Windows 10 and installing the devkit on Windows 8 didn't help.

@jhdxr
Copy link
Member Author

jhdxr commented Nov 16, 2016

@lances101 well, after I reinstall win10 sdk I can compile the latest code successfully. Unfortunately I don't think the quick fix would work, because wox still consume almost all of my free memory (5G+) and cpu (20%+) even I comment all the codes relating to _uwps in Main.cs.

I'm not quite familar with neither c# nor vs, so I cannot figure out what happend. but I capture a screenshot
printscreen

maybe you could give me some suggestions on how to profiler?

@lances101
Copy link
Member

@jhdxr Let me update you on how things are going.

I've tried to replicate your issue, but the main problem is that I have a different build on the VM that i'm running (I'm at build 14393, while you are running the build from November 2015). The issue just does not happen on newer builds of Windows.

I am already downloading and installing your specific build just in case, but we should be able to debug this without it.

  • Does the long loading time happen every time? If not, do you know how you can trigger it?
  • Does the memory ramp up immediately after start?

@bao-qian
Copy link
Member

bao-qian commented Nov 16, 2016

will this happens on v1.3.183 (the release version)?

@lances101
Copy link
Member

@happlebao from the first post from @jhdxr:

1.3.231 works fine

and we did not have any other reports for 1.3.183 of this matter

@bao-qian
Copy link
Member

bao-qian commented Nov 16, 2016

@jhdxr @lances101 two suggestion for debugging

  1. set a breakpoint here https://github.com/Wox-launcher/Wox/blob/master/Plugins/Wox.Plugin.Program/Main.cs#L40, and post _win32[] variable content, or any variable contains huge infos..
  2. freetime for teamviewer this weekend...? ( or you could leave your pc open after you sleep, maximum our timezone benefit..)

@lances101
Copy link
Member

lances101 commented Nov 16, 2016

@jhdxr, if so it is that you did install visual studio, we could then get a runtime dump with your problem.

Here's how:

  1. Launch Visual Studio and open Wox's solution
  2. hit Alt+F2 and the diagnostic tools window should appear. If the hotkey did not work, you can open it manually from this menu (image)
  3. Select the Application Timeline and CPU Usage check boxes (sadly, I do not know what is their chinese counterpart) and hit the Start button.
  4. You should see something similar to this
  5. Once Wox unfreezes, hit the stop button.
  6. Now press "File" in the upper right and "Save".
  7. The file you saved is most likely pretty big (>10MB). Upload it to a file hosting service of your choice and provide us with a link.

This will allow us to check how long specific functions took on your machine.

If you don't want to go through the hassle, then it will be easier if @happlebao just connects to you remotely.

@jhdxr
Copy link
Member Author

jhdxr commented Nov 17, 2016

@lances101

  • this issue happens all the time. you just need to enable program plugin, which is enabled by default, and search anything.
  • no, you have to search something to trigger

@happlebao 1.3.183 works fine.

here is the link for the dump file: http://pan.baidu.com/s/1geLGjqr (the password for open this link is cat4)

@lances101
Copy link
Member

lances101 commented Nov 17, 2016

@jhdxr Now I know why I cannot replicate your error. It's the Pinyin scoring system. It is weird why this bug is not more widespread for people on 1.3.295.
2016-11-17 21 36 50

It will be hard for me to debug it. Maybe if @happlebao can dedicate some time to it during the weekend it would be great.

@bao-qian
Copy link
Member

@jhdxr you os language is simplified chinese?

@bao-qian
Copy link
Member

although the current pinyin algorithm is extremely bad, but the modification is before 1.3.81.3
da36c99

probably combine with the current bad implementation of uwp... things go worth..?

@jhdxr could you use binary search method to find the affected build?
log2(295-231)=6

@bao-qian
Copy link
Member

@jhdxr
Copy link
Member Author

jhdxr commented Nov 18, 2016

@lances101 @happlebao no, the language for my os and wox is english, although most of my programs and apps use simplified chinese as the default language

@bao-qian
Copy link
Member

image
image
image

hi @jhdxr
I checked the report again,
the main problem is ui (related to image) instead of pinyin module.
The ui resource cause long time to render (5s) and more time consuming 2nd generation blocking garbage collection. This type of gc will block ui,

please help me with following step,

  1. open the code (1.3.295) in vs
  2. open 报告20161117-1337.diagsession in vs
  3. click create detailed report in CPU usage tab
  4. save and upload the file.

image

@bao-qian
Copy link
Member

bao-qian commented Nov 30, 2016

and could you also try 1.3.265 and 1.3.321 ?

@bao-qian
Copy link
Member

bao-qian commented Nov 30, 2016

probally releated
#1051
#198 (comment)
#1061
#1052 (comment)

@jhdxr
Copy link
Member Author

jhdxr commented Nov 30, 2016

@happlebao vs tells me "未能创建详细的报告。", and even I created a new dump, I still got the same error.

and I'm a little busy these days, so I'll try those builds when I'm free

@bao-qian
Copy link
Member

take your time :)

any more details about "未能创建详细的报告"?
screenshot or output from bottom tab?

@bao-qian
Copy link
Member

I can produce this on a fresh zh-cn install now

  1. download edge on win10 14393 vm
  2. boot it and add simplified chinese language, set it as display language, and add language pack
  3. reboot
  4. download latest wox, after some typing, the cpu usage will exceed 30% and memory usage will exceed 2gb.

@jhdxr
Copy link
Member Author

jhdxr commented Dec 1, 2016 via email

@bao-qian
Copy link
Member

bao-qian commented Jan 12, 2017

@bao-qian
Copy link
Member

bao-qian commented Jan 12, 2017

the root cause is permutation is really slow for large numbers,
remove tones for pinyin will reduce the numbers needed for permutation for some common cases.
.net really lacks a good pinyin library can handle chinese polyphone properly,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants