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

trf: Add client traffic management to the CLI #3959

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from

Commits on Jul 17, 2023

  1. Configuration menu
    Copy the full SHA
    c418c13 View commit details
    Browse the repository at this point in the history
  2. smug: Pass file descriptors from mgt to cache

    The new smuggling facility allows mgt to abuse the heritage process and
    sneak file descriptors to the cache process via a socket pair. This new
    trade route will allow the cache to escape its jail and get privileged
    file descriptors anyway. The smuggler's fence is hidden in plain sight,
    in the heritage facility, which explains such a smug attitude.
    
    Signed-off-by: Dridi Boukelmoune <dridi.boukelmoune@gmail.com>
    mbgrydeland authored and dridi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    3800c05 View commit details
    Browse the repository at this point in the history
  3. mgt: New Traffic VSM segment

    It will be used by the file descriptor smuggler to pass nonces for
    listen sockets.
    dridi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    79e6d50 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    dfe0fb2 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    35e8c04 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6b20814 View commit details
    Browse the repository at this point in the history
  7. vca: Join the listen socket smuggling ring

    We use the Traffic VSM segment to pass the nonces to the cache process,
    and this how they synchronize in case of partial success. Though not
    likely during startup, it is still possible to fail the transfer of a
    file descriptor, for example when running into a limit. It will become
    less unlikely once this may happen at any point of the cache run time.
    dridi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    1c261bf View commit details
    Browse the repository at this point in the history
  8. trf: Add client traffic management to the CLI

    The interface offered for operations is a set of traffic.accept,
    traffic.refuse and traffic.status commands with similar semantics
    as start, stop and status.
    
    The child process will eventually listen to the traffic.start and
    traffic.refuse commands, but for now only a pseudo accept_traffic
    parameter is added in struct params. It will be used when tasks
    running on worker threads reach certain points to decide whether
    to keep processing requests or not.
    dridi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    6e84b57 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f012451 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    794b865 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    b76e439 View commit details
    Browse the repository at this point in the history
  12. cache: Ignore SIGUSR1

    It will be used internally to interrupt blocking accept(2) calls.
    dridi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    24b1769 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    7a304ea View commit details
    Browse the repository at this point in the history
  14. vca: Honor traffic.status by closing listen sockets

    The accept tasks pool themselves in order to later block on the
    pool_accepting variable. There could be a more efficient scheduling
    policy, but once we stop accepting new traffic the workload will
    mechanically wind down and having one worker per pool per listen
    socket stuck in a sleep loop ought to be an acceptable trade off,
    just like during the cache startup.
    
    This is triggered by MGT via the cache's CLI, using the same traffic
    management commands. When the acceptor shutdown is triggered, worker
    threads tracked as busy accepting new connections are signaled with
    the no-op SIGUSR1. The CLI thread waits for the last busy worker
    to signal that nothing else is using the listen sockets, so they
    can be closed safely, getting rid of an unfortunate race condition.
    dridi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    0c3b47e View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    3b286ff View commit details
    Browse the repository at this point in the history
  16. h2: Honor traffic.status with GOAWAY frame

    Stop accepting new streams but allow ongoing transactions to complete
    gracefully. Since this is an error condition that allows the rx loop to
    continue, avoid sending a GOAWAY frame more than once.
    dridi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    8f4291f View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    e49b3e7 View commit details
    Browse the repository at this point in the history
  18. http1: Honor traffic.refuse with a minimal 503

    Otherwise it leads to this sequence of events:
    
    - client sends request
    - request proceeds
    - client triggers timeout_linger
    - client session enters waiter
    - traffic.refuse
    - client sends request
    - client session leaves the waiter
    - request proceeds
    
    The last step is the one traffic.refuse is supposed to prevent.
    dridi committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    907bd61 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    fc424e8 View commit details
    Browse the repository at this point in the history