gdcef icon indicating copy to clipboard operation
gdcef copied to clipboard

godot-4 branch: Stopping debug mode in editor often does not close gdcefSubProcess.exe on Windows 11

Open TheSilentFog opened this issue 1 year ago • 6 comments

I just discovered that running gdcef on windows 11 from the editor and subsequently stopping the debug run often results in the browser background process to not close at all.

This behaviour seems to be unconsistent from what I do with the open browser inside the godot run window.

I had an instance of this problem where after even some failed runs on godot, due to code errors, there were 5 ghost browser processes using almost all of my cpu. I had to kill them one by one on the task manager.

Shouldn't be there, inside the browser process, a ping system which checks if the godot process that created it is still alive to prevent edge cases?

I was trying things out on the 2D demo project.

image

TheSilentFog avatar Jan 25 '24 18:01 TheSilentFog

@TheSilentFog, in nominal cases, whatever the operating system you are using, if you see multiple cef processes, this is normal: CEF creates many forks of itself (Firefox also do the same things).

If these processes are not correctly killed, this is an issue. I checked on Linux, I do not have this issue. @raphipod can you check (I do not have windows).

Lecrapouille avatar Jan 25 '24 21:01 Lecrapouille

Hello, I encountered the same problem on Windows 10 and v0.10.0-godot4 image

Reproduce steps are easy:

  1. Hit Play in Godot, wait until browser loads website.
  2. Hit Stop.
  3. You should have 1 ghost process in Task Manager

Repeat steps to get more ghost processes.

Pastew avatar Jun 16 '24 11:06 Pastew

@TheSilentFog, in nominal cases, whatever the operating system you are using, if you see multiple cef processes, this is normal: CEF creates many forks of itself (Firefox also do the same things).

If these processes are not correctly killed, this is an issue. I checked on Linux, I do not have this issue. @raphipod can you check (I do not have windows).

That's correct. It works properly on Linux, weirdly enough.

I have yet to test it on Windows specifically, but on my prior debug tests I also noted this and thought it was normal as CEF uses multiple threads for rendering/drawing, audio, network etc.

AFAIK, the CefShutdown() function should be executed in the thread where CefInitialize() should've been called beforehand, so that all subprocesses can get notified. Which get's executed here.

I must admit I don't know much C++, so I am most likely not qualified enough for this issue ;)

@TheSilentFog did you have an antivirus running in the background at the time of testing? It could be that some subprocesses are getting flagged/quarantined by an AV.

raphipod avatar Jun 16 '24 13:06 raphipod

I know That GDCef instance is not destroyed. Maybe because Godot is still using it when inside the editor (ref counter). It is released when Godot ends. On Linux forks are killed I guess artificially. So maybe in Windows there is not such security

Lecrapouille avatar Jun 17 '24 07:06 Lecrapouille

  1. I noticed it doesn't happen every time.

But when it happens, after I hit Play button in Godot I see many gdcefSubProcesses under Godot process: image

And after I hit Stop one of them seems to be somehow detached from parent process and stays alive forever in "Background processes" category in Task Manager. image

  1. Closing Godot Editor does not kill this gdcefSubProcess.

Pastew avatar Jun 21 '24 13:06 Pastew

I concur, it does not happen every time, but it can quickly stack up. Has anyone had issues with this regarding a production build besides during development? If so then we need to expedite a fix. My PC (windows) came to a grinding halt because these subprocesses were taking up my entire CPU during development.

pimhakkert avatar Jul 23 '24 21:07 pimhakkert

Yes this is a real issue @face-hh https://youtu.be/37ISfJ2NSXQ?feature=shared&t=446 noticed it :) @eliopark-nsuslab have you idea ? I think probably a conflict between Godot's RefCount and CEF's RefCount. On Linux I do not have such zombies exe running.

Lecrapouille avatar Sep 23 '24 23:09 Lecrapouille

I tried on the new commit where I manage better the shutdown of browsers. I see nothing special. And yes CEF seems to spawn several processes, this is how it works but hard for me to say if this happens the same thing for other applications based on CEF

Lecrapouille avatar Dec 03 '24 00:12 Lecrapouille

Yes this is a real issue @face-hh https://youtu.be/37ISfJ2NSXQ?feature=shared&t=446 noticed it :) @eliopark-nsuslab have you idea ? I think probably a conflict between Godot's RefCount and CEF's RefCount. On Linux I do not have such zombies exe running.

@Lecrapouille I've been having the same problem, but haven't found a solution yet.

eliopark-nsuslab avatar Dec 03 '24 00:12 eliopark-nsuslab

@eliopark-nsuslab Can you try my latest commit and tell me if this fix or not

Lecrapouille avatar Dec 03 '24 00:12 Lecrapouille

https://github.com/cefsharp/CefSharp/issues/1075

Lecrapouille avatar Dec 03 '24 00:12 Lecrapouille

I have the same thing on Linux but now I better close Godot nodes I guess.

Lecrapouille avatar Dec 03 '24 00:12 Lecrapouille

@eliopark-nsuslab cannot you join the discord ?

Lecrapouille avatar Dec 03 '24 01:12 Lecrapouille

I'm closing since I think I fixed it. Open a new issue if this is not the case

Lecrapouille avatar Dec 03 '24 23:12 Lecrapouille

@Lecrapouille are there artifacts available to download? I can't find it in github actions

Pastew avatar Dec 04 '24 06:12 Pastew

Not yet released i'll try to inclure download management and javascript bindings

Lecrapouille avatar Dec 04 '24 07:12 Lecrapouille

@Pastew @eliopark-nsuslab The 0.14 version has been released. Tell me if better if not

Lecrapouille avatar Dec 07 '24 11:12 Lecrapouille