xemu icon indicating copy to clipboard operation
xemu copied to clipboard

CORE: exec should not leave zombie processes on UNIX'es

Open lgblgblgb opened this issue 4 years ago • 2 comments

Xemu's exec layer was designed to have parallel external process running for longer time and can be queried by Xemu. However for functions like launching a file browser requires no such a functionality. Though since process is not wait()'ed in this case, it leads the launched process to have zombie state after it exists. The goal is to fix this situation.

lgblgblgb avatar Jun 07 '20 14:06 lgblgblgb

I just launches a browser window from xmega65.native (Linux build, commit 091c3d92cf590dca1cab59959b40c840488df9c9) via "right-click-menu" item "Help (online) > Download MEGA65 book" and can confirm this in ps afux:

eugen    11745  0.3  0.2 992340 86188 ?        Sl   07:52   0:05  \_ /usr/bin/konsole
eugen    11825  0.0  0.0  20376 10384 pts/1    Ss   07:52   0:00      \_ /bin/bash
eugen    15621 26.6  0.2 1881008 82724 pts/1   Sl+  08:09   2:59          \_ ./build/bin/xmega65.native
eugen    15637  0.0  0.0      0     0 pts/1    Z+   08:10   0:00              \_ [xdg-open] <defunct>

euneuber avatar Apr 20 '21 06:04 euneuber

Yes, quite natural thing, since on UNIX, a process must be wait()-ed by the parent otherwise it's kept in so called "zombie state" to carry on its status can be queried by its parent with the mentioned syscall. So I'm very well aware of the issue even its root cause just it would need major effort to solve this, and it's not so important anyway to get priority (it just ugly, it won't affect anything to much). Actually, the process is wait()'ed if you activate some help item again, just then you have another zombie, so clearly there should be another point to "collect" wait'ed processes, just not so much a clear way currently to do. Anyway, since a zombie process actually does not allocate almost any resource, and always the last one "can be seen" only, I wouldn't say it's a big issue, though I kept this issue around when I have time / chance anything to make it more nice to leave any zombie, I think it's more a "cosmetic" issue than anything serious which effect anything otherwise.

lgblgblgb avatar Apr 20 '21 07:04 lgblgblgb

Probably simply does not worth the effort, would be complicated to solve and not so much gain, just "cosmetic" one ...

lgblgblgb avatar Feb 09 '23 15:02 lgblgblgb