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

IH-533: Remove usage of forkexecd daemon to execute processes #5995

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Sep 13, 2024

  1. fe_test: add test for syslog feature

    The syslog feature allows to run a program and redirect its output/error
    stream to system log. It's triggered passing "syslog_stdout" argument to
    "Forkhelpers" functions like "execute_command_get_output".
    To test this feature use a small preload library to redirect syslog writing.
    This allows to test program without changing it.
    The log is redirected to /tmp/xyz instead of /dev/log. The name was chosen
    to allow for future static build redirection.
    The C program is used only for the test, so the code style take into account
    this (specifically it does not try to handle all redirect situation and all
    error paths).
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    freddy77 committed Sep 13, 2024
    Configuration menu
    Copy the full SHA
    3823110 View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2024

  1. IH-533: Remove usage of forkexecd daemon to execute processes

    Forkexecd was written to avoid some issues with Ocaml and
    multi-threading.
    Instead use C code to launch processes and avoid these issues.
    Interface remains unchanged from Ocaml side but implementation rely
    entirely on C code.
    vfork() is used to avoid performance memory issue.
    Reap of the processes are done directly.
    Code automatically reap child processes to avoid zombies.
    One small helper is used to better separate Ocaml and C code and
    handling syslog redirection. This allows to better debug in
    case of issues.
    Syslog handling is done in a separate process allowing to restart
    the toolstack and keep launched programs running;
    note that even with forkexecd daemon one process was used for this
    purpose.
    Code tries to keep compatibility with forkexecd, in particular:
    - SIGPIPE is ignored in the parent;
    - /dev/null is open with O_WRONLY even for stdin;
    - file descriptors are limited to 1024.
    We use close_range (if available) to reduce system calls to close
    file descriptors.
    Cgroup is set to avoid systemd closing processes on toolstack restart.
    There's a fuzzer program to check file remapping algorithm; for this
    reason the algorithm is in a separate file.
    
    To turn internal debug on you need to set FORKEXECD_DEBUG_LOGS C
    preprocessor macro to 1.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    freddy77 committed Sep 18, 2024
    Configuration menu
    Copy the full SHA
    a4a2f94 View commit details
    Browse the repository at this point in the history