ImageGlass icon indicating copy to clipboard operation
ImageGlass copied to clipboard

ImageGlass process(es) sometimes stays open and hogs CPU after closing app

Open shoebillanon opened this issue 2 years ago • 6 comments

No idea how to replicate this but sometimes ImageGlass' process will stay active in the background after closing the app and hog about 30% of my CPU. This can happen multiple times too, resulting in multiple processes hogging 30% CPU each. I just updated from 8.2 to 8.5 and thought the bug was gone but nope.

shoebillanon avatar Feb 22 '22 23:02 shoebillanon

Off-hand do you recall if the thumbnail bar was visible at the time of closing? Or did you edit (crop/rotate) the file you were looking at when you closed?

[These are the likeliest things I can think of off-hand which might be still running in the background at exit.]

fire-eggs avatar Feb 23 '22 01:02 fire-eggs

Nope, neither. Was just looking at images and that is it.

shoebillanon avatar Feb 23 '22 17:02 shoebillanon

I've yet to see the "hogging 30% of the CPU" issue, but I was able to get IG to have three background processes running with 8.5.1.22.

  1. No IG background process.
  2. Run IG. In settings, check "continue running background"; save. Exit IG.
  3. Note there is an IG background process.
  4. Run IG. In settings, uncheck "continue running background"; save. Exit IG.
  5. Note there is still an IG background process. [Bug!]
  6. Run IG. In settings, check "continue running background"; save. Exit IG.
  7. There are now two IG background processes. [Bug!]
  8. Run IG. Make sure that "allow multiple instances" option is OFF. After that, when exiting IG, there are now three background IG processes. [Bug!] Also, running IG at this point does not show the welcome picture, even though that setting is on. [Bug?]

Turning off the "background" option in IG, and not checking "Start with OS", then a reboot or re-login will probably be required to clear all background processes. [Or killing them manually via Task Manager.]

As far as the 30% CPU issue, I'm still investigating, but make sure that "check for update automatically" is not selected when running IG.

fire-eggs avatar Feb 28 '22 14:02 fire-eggs

One thing that occurs to me: when IG is "closed", the current FileWatcher doesn't appear to be stopped. I believe this means the IG background process is still watching the last viewed image folder. If that folder is "active" then IG could spend some cycles processing changes which aren't being viewed.

fire-eggs avatar Feb 28 '22 15:02 fire-eggs

This is somewhat tangential, but you mentioned it in your reproduction steps, how is "allow multiple instances" supposed to work with "continue running in background"? To me they seem mutually exclusive.

The only way I can see them working together is if ImageGlass used multiple windows for viewing images. The code isn't really conducive to this, when looking at it there seems to be an assumption that the process only has one viewport window.

Sxderp avatar Mar 08 '22 21:03 Sxderp

If it has multiple instances, only the last instance will be kept running.

You can see the implementation below: https://github.com/d2phap/ImageGlass/blob/7c416b299c2b5bf9f4acbc4c603a41e68fa64047/Source/ImageGlass/frmMain.cs#L3246-L3272

d2phap avatar Apr 27 '22 14:04 d2phap

Should not an issue with v9

d2phap avatar Dec 14 '23 08:12 d2phap