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

Modules: Carry context from incoming requests to hooks #4007

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

Conversation

scr-oath
Copy link
Contributor

This change

  1. Allows disconnects from the server to cancel further work
  2. Uses the same timeout via Done channel rather than using (and leaking; never canceling) a time.After timer for every stage.
  3. Recovers from panics, which would previously halt the app
  4. Doesn't run hooks when the context is already failed (such as when client navigates away).

@bsardo bsardo changed the title Fixes 3962 Ensure that the context carries all the way through the incoming request to the module hooks Modules: Carry context from incoming requests to hooks Oct 23, 2024
@scr-oath
Copy link
Contributor Author

scr-oath commented Nov 4, 2024

Fixes #3962

@bsardo
Copy link
Collaborator

bsardo commented Nov 4, 2024

Hi @scr-oath, can you please merge with master and resolve conflicts? Thanks!

@scr-oath
Copy link
Contributor Author

scr-oath commented Nov 6, 2024

Hi @scr-oath, can you please merge with master and resolve conflicts? Thanks!

DONE

@scr-oath scr-oath force-pushed the 3962-propagate-context branch from 47f9583 to f9bc46d Compare December 3, 2024 17:16
@scr-oath scr-oath marked this pull request as draft December 9, 2024 23:14
@scr-oath
Copy link
Contributor Author

scr-oath commented Dec 9, 2024

FWIW, marking draft - we're fighting with some mobile SDK crashes related to the piece that adds the full-request timeout stuff… essentially, SDK crashes if the passthrough exists and we have a hook to remove it, which doesn't run if the entire request times out - the fix was fairly straightforward but grows this to have HoldAuction return the ctx.Err() so that that can be honored as a writeError call (not 200 OK).

This also has me thinking - that hooks should probably have some way of declaring that they are critical - as in - timeouts should be treated as reject (or whole-request timeout)

@scr-oath scr-oath marked this pull request as ready for review December 13, 2024 06:53
@scr-oath scr-oath marked this pull request as draft December 13, 2024 16:06
@scr-oath
Copy link
Contributor Author

We discussed this a fair bit in the Prebid Server backlog review and it seems there are other concerns/needs that may need some thought/discussion.

  1. Tmax should be used as a calculation for time to give bidders but not block the entire request
  2. Some hooks should be guaranteed to run (if they time out, it should be treated as a reject)
  3. If the client disconnects, some teams still want to run to completion to capture the information about the auction for their data processing.

Therefore, It would seem that a writeup and review of a solution should be done before implementation and PR is completed, which I'll tackle in an issue and/or google doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants