clan_vm_manager: Partially working process executor with killpg #656

Merged
clan-bot merged 6 commits from Qubasa-main into main 2023-12-19 17:05:21 +00:00
Owner

merge

Added proc executor

Fully working executor

Improved spawn interface. Added garbage collector

nix fmt

merge Added proc executor Fully working executor Improved spawn interface. Added garbage collector nix fmt
clan-bot was assigned by Qubasa 2023-12-19 17:02:29 +00:00
Qubasa added 6 commits 2023-12-19 17:02:29 +00:00
clan-bot merged commit 30e7e06f59 into main 2023-12-19 17:05:21 +00:00
Mic92 reviewed 2023-12-20 09:37:11 +00:00
@ -0,0 +137,4 @@
# Create stdin fifo
if in_file.exists():
in_file.unlink()
os.mkfifo(in_file)
Owner

Fifos will block writes until there is one consumer:

% mkfifo foo
% echo foo > foo # hangs

I wouldn't have them until you have a guaranteed consumer.

Fifos will block writes until there is one consumer: ``` % mkfifo foo % echo foo > foo # hangs ``` I wouldn't have them until you have a guaranteed consumer.
Mic92 reviewed 2023-12-20 09:38:12 +00:00
@ -0,0 +95,4 @@
print(f"Started new process pid={pid} gpid={gpid}")
# Register the signal handler for SIGINT
signal.signal(signal.SIGTERM, _signal_handler)
Owner

Why not stop qemu with in a try finally block? Signal handler have the issue that you can only ever have one of them.

Why not stop qemu with in a `try finally` block? Signal handler have the issue that you can only ever have one of them.
Owner

You also don't need global variables than.

You also don't need global variables than.
Mic92 reviewed 2023-12-20 09:38:51 +00:00
@ -0,0 +85,4 @@
os.setsid()
# Open stdout and stderr
out_fd = os.open(str(out_file), flags=os.O_RDWR | os.O_CREAT | os.O_TRUNC)
Owner

This leaks a file descriptor

This leaks a file descriptor
Owner
    with open(out_file, "w") as out_fd:
        os.dup2(out_fd.fileno(), sys.stdout.fileno())
        os.dup2(out_fd.fileno(), sys.stderr.fileno())
    in_fd = os.open(str(in_file), flags=flags)
    try:
        os.dup2(in_fd, sys.stdin.fileno())
    finally:
        os.close(in_fd)
``` with open(out_file, "w") as out_fd: os.dup2(out_fd.fileno(), sys.stdout.fileno()) os.dup2(out_fd.fileno(), sys.stderr.fileno()) ``` ``` in_fd = os.open(str(in_file), flags=flags) try: os.dup2(in_fd, sys.stdin.fileno()) finally: os.close(in_fd) ```
Mic92 reviewed 2023-12-20 09:42:57 +00:00
@ -105,1 +105,4 @@
parser.set_defaults(func=show_overview)
# Define a function that writes to the memfd
Owner

memfd?

memfd?
Mic92 added the
changes-requested
label 2023-12-20 09:43:45 +00:00
Owner

More fixes in #682

More fixes in https://git.clan.lol/clan/clan-core/pulls/682
Mic92 removed the
changes-requested
label 2024-01-02 14:36:19 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: clan/clan-core#656
No description provided.