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

Fix browser not stop during aborts (e.g. SIGTERM) #1420

Merged
merged 19 commits into from
Sep 12, 2024

Commits on Sep 11, 2024

  1. Rename ctx to backgroundCtx

    This helps us by clarifying that this is a background context, and not
    controlled by k6 (i.e. the VU context). The background context is to
    only be used to control the lifecycle of chromium/connection. In later
    commits vu context will be reintroduced to control the iteration
    lifecycle so that k6 can abort the iteration and the browser module
    doesn't block that from happening.
    ankur22 committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    83f5247 View commit details
    Browse the repository at this point in the history
  2. Use two contexts

    The background context will be used for the chromium subprocess,
    connection and things that need to be controlled by the iterStart and
    iterEnd (k6 event system) events. The k6Ctx is the context that is
    controlled by the vu context. This will allow the iteration to abort
    due to a SIGTERM while also allowing chromium to exit with endIter/exit
    events.
    
    At the moment this only introduces the k6Ctx, but it is still the
    background context.
    ankur22 committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    d52f7f4 View commit details
    Browse the repository at this point in the history
  3. Rename k6Ctx to vuCtx

    vuCtx is a clearer name which represents the VU context.
    ankur22 committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    4717c55 View commit details
    Browse the repository at this point in the history
  4. Use vuCtx and backgroundCtx

    Now that Browser is setup to work with the different contexts, let's
    actually set them up correctly.
    ankur22 committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    7eadd37 View commit details
    Browse the repository at this point in the history
  5. Rename cancelFn to vuCtxCancelFn

    This rename makes it clearer which context will be cancelled if the
    function is called.
    ankur22 committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    31bc129 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    297daf6 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6138c98 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    600d028 View commit details
    Browse the repository at this point in the history
  9. Remove background context from module and reg

    The background context isn't needed here. We're removing it to make
    things clearer later on when we get to creating the Browser type, which
    uses the cu context.
    ankur22 committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    951be75 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    e439161 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    c9734fe View commit details
    Browse the repository at this point in the history
  12. Fix imports

    ankur22 committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    704e466 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    5024e4e View commit details
    Browse the repository at this point in the history
  14. Add a cancellable context to Browser init go

    It didn't feel right having a goroutine where there was no way of
    shutting it down. Now when the browser.Close() method is called it will
    shut the init goroutine down too.
    ankur22 committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    dbac2f9 View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2024

  1. Update the comments on context background

    This is to ensure that we remember why we're using context.Background
    for launching or connecting to chromium.
    ankur22 committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    b52ef8a View commit details
    Browse the repository at this point in the history
  2. Add comment on initContext

    ankur22 committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    41ad3e0 View commit details
    Browse the repository at this point in the history
  3. Add get browser count

    Encapsulate the retrieval of the browser count from the registry.
    ankur22 committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    f371941 View commit details
    Browse the repository at this point in the history
  4. Add get iteration trace count

    Encapsulate the retrieval of the iteration trace count from the
    registry.
    ankur22 committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    ac2df75 View commit details
    Browse the repository at this point in the history
  5. Rename getIterationTracesCount & getBrowserCount

    To be more idiomatic go
    ankur22 committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    89bcc73 View commit details
    Browse the repository at this point in the history