Juampa
Juampa

Reputation: 31

QProcess::startDetached() hangs out when executing google-chrome

The issue is present only on CentOS 7, using Qt 5.12.6

In the Qt application we open a configuration tool using the following command:

QProcess::startDetached("google-chrome", {"http://localhost:8080/"});

For some strange reason, the exit the application is not completed (the last return exitCode in main() is executed) and only when Chrome's window is closed, the application process finishes.

Here is what I see after quit the application (the GUI was closed):

$ pstree -p 26609
Application(26609)─┬─QtWebEngineProc(26702)
                   ├─{Application}(26652)
                   ├─{Application}(26653)
                   ├─...

For some reason, the QtWebEngineProc remains running associated to the Application.

$ cat /proc/26702/status 
Name:   QtWebEngineProc
Umask:  0002
State:  S (sleeping)
Tgid:   26702
Ngid:   0
Pid:    26702
PPid:   26609
TracerPid:  0
Uid:    2000    2000    2000    2000
Gid:    2000    2000    2000    2000
FDSize: 1024
Groups: 10 977 978 979 2000 
VmPeak:   436736 kB
VmSize:   436732 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:     23172 kB
VmRSS:     23172 kB
RssAnon:        5580 kB
RssFile:       17592 kB
RssShmem:          0 kB
VmData:     2092 kB
VmStk:       132 kB
VmExe:         4 kB
VmLib:    153160 kB
VmPTE:       484 kB
VmSwap:        0 kB
Threads:    1
SigQ:   1/62901
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000002
SigCgt: 0000000180010000
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000001fffffffff
CapAmb: 0000000000000000
NoNewPrivs: 1
Seccomp:    0
Speculation_Store_Bypass:   thread vulnerable
Cpus_allowed:   fff
Cpus_allowed_list:  0-11
Mems_allowed:   00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
Mems_allowed_list:  0
voluntary_ctxt_switches:    109
nonvoluntary_ctxt_switches: 2

Do you know what could be happening with QtWebEngine that stays attached to my main process?

Do you have some trick to mimic gio open using a bash script without making my hard-coded gio version in C?

Note 1: The usage xdg-open or gio open does not hangs the exit of the main application's process, but I cannot use it because I need to open Chrome and not the default browser.

QProcess::startDetached("xdg-open", {"http://localhost:8080/"});

Note 2: the same Application in RockyLinux 9.3 does not have this behavior, it works.

Note 3: The usage system() did not work

system("bash -c \"google-chrome http://localhost:8080/\" &");

Upvotes: 1

Views: 27

Answers (0)

Related Questions