Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

record the correct pid for ibus-daemon #4499

Open
totaam opened this issue Feb 10, 2025 · 0 comments
Open

record the correct pid for ibus-daemon #4499

totaam opened this issue Feb 10, 2025 · 0 comments
Labels
enhancement New feature or request linux server

Comments

@totaam
Copy link
Collaborator

totaam commented Feb 10, 2025

We run:

IBUS_DAEMON_COMMAND = os.environ.get("XPRA_IBUS_DAEMON_COMMAND",
"ibus-daemon --xim --verbose --replace --panel=disable --desktop=xpra --daemonize")

And we then record the pid, expecting to be able to use it later:

xpra/xpra/scripts/server.py

Lines 1087 to 1091 in 7a77df6

# maybe we are inheriting one from a dead session?
ibus_daemon_pid = load_pid(session_dir, "ibus-daemon.pid")
if not ibus_daemon_pid or not os.path.exists("/proc") or not os.path.exists(f"/proc/{ibus_daemon_pid}"):
Logger("ibus").debug("adding ibus-daemon to late startup")
opts.start_late.insert(0, IBUS_DAEMON_COMMAND)

This cannot work since the process has daemonized and therefore changed its pid.
We could handle the daemonization ourselves and return the correct pid:

xpra/xpra/server/util.py

Lines 334 to 340 in 7a77df6

def daemonize() -> None:
os.chdir("/")
if os.fork():
os._exit(0) # pylint: disable=protected-access
os.setsid()
if os.fork():
os._exit(0) # pylint: disable=protected-access

First reported in #4449 (comment)

@totaam totaam added enhancement New feature or request linux server labels Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linux server
Projects
None yet
Development

No branches or pull requests

1 participant