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

Support running Server without std::process::exit #492

Open
kriswuollett opened this issue Dec 12, 2024 · 0 comments · May be fixed by #493
Open

Support running Server without std::process::exit #492

kriswuollett opened this issue Dec 12, 2024 · 0 comments · May be fixed by #493
Labels
enhancement New feature or request

Comments

@kriswuollett
Copy link

Problem

Pingora server code assumes it won't be wrapped by something else since the only entry point Server::run_forever which calls std::process::exit(0).

Solution

Refactor Server so that an additional run function can be called that returns with Result instead of exiting the process. It would be up to the caller to support daemonization or not. I'd assume the daemonization and shutdown signal generation code could be refactored out so that a pingora wrapper could use them as needed.

Basically, would be nice to see code similar to how axum can be run:

    axum::serve(listener, app)
        .with_graceful_shutdown(shutdown_signal())
        .await

Alternatives

  • Fork/exec from wrapper (whether Rust or not)
    • Advantages:
      • Can sandbox pingora (if OS supports)
      • If separate binary, options other than pingora are possible
    • Disadvantages:
      • Would require setting up IPC or RPC to control the proxy instead something else like a FFI binding

Additional context

Planning to supporting features like #374 may influence the overall design.

@Noah-Kennedy Noah-Kennedy added the enhancement New feature or request label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants