Page 1 of 1

Sometime one process can't quit

Posted: Sun Aug 13, 2023 8:34 am
by tad.chen
I find that sometime one process of the browser is still running after the browser quits.

I find it in the task manager window, and the CPU usage of the process is high, about 15%.

I don't know the reason of this issue and don't know how to debug it.

Could you give me some advice?

Re: Sometime one process can't quit

Posted: Sun Aug 13, 2023 9:50 am
by salvadordf
Hi,

Perhaps this CEF issue is related :
https://github.com/chromiumembedded/cef/issues/3532

It would be extremely helpful to have a step-by-step guide to reproduce that issue with a minimal demo.

Once you have a reliable way to reproduce this issue then you can use this guide to debug it if it's a CEF issue :
https://www.briskbard.com/forum/viewtopic.php?f=10&t=1050

Re: Sometime one process can't quit

Posted: Wed Aug 16, 2023 9:37 am
by tad.chen
Thank you for your information!

This issue is only found in my browser, and occurs randomly. I can't reproduce it with any Demos in cef4Delphi package.

Now, I fixed it by adding some code which kill all processes of the browser after DestroyGlobalCEFApp statement, and it works.

Re: Sometime one process can't quit

Posted: Mon Jan 29, 2024 5:22 pm
by homer
I have run into the same problem. Could you share how you killed the running instances, please?

Re: Sometime one process can't quit

Posted: Wed Feb 07, 2024 5:02 am
by dungnn
taskkill /pid [mainprocessid] /t /f

replace main process id with GetCurrentProcessId, exec it when form destroy and you'll be fine

Re: Sometime one process can't quit

Posted: Tue May 07, 2024 12:59 am
by tad.chen
homer wrote: Mon Jan 29, 2024 5:22 pm I have run into the same problem. Could you share how you killed the running instances, please?
Sorry, I've not seen your question. I wrote a function to do this.

Code: Select all

procedure KillProcessStillRunning;
var
  TempHandle   : THandle;
  TempProcess  : TProcessEntry32;
  TempPID      : DWORD;
  TempProcHWND : HWND;
  TempMemCtrs  : TProcessMemoryCounters;
  TempMain, TempSubProc, TempName : string;
begin
  TempHandle := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
  if (TempHandle = INVALID_HANDLE_VALUE) then exit;

  ZeroMemory(@TempProcess, SizeOf(TProcessEntry32));
  TempProcess.dwSize := Sizeof(TProcessEntry32);
  TempPID            := GetCurrentProcessID;

  Process32First(TempHandle, TempProcess);

  repeat
    if TempProcess.th32ParentProcessID = TempPID then
    begin
      TempName := TempProcess.szExeFile;
      TerminateProcess(OpenProcess(PROCESS_TERMINATE, BOOL(0),
                          TempProcess.th32ProcessID),0);
    end;
  until not(Process32Next(TempHandle, TempProcess));

  CloseHandle(TempHandle);
end;