Repository navigation
fix 503's when php runtime shuts down mid-incoming-request, hand them off to the new config runtime - #2709
Open
henderkes wants to merge 3 commits into
Open
fix 503's when php runtime shuts down mid-incoming-request, hand them off to the new config runtime#2709henderkes wants to merge 3 commits into
henderkes wants to merge 3 commits into
Conversation
Comment on lines
+421
to
+430
| } else if auth, _ := h.(*caddyauth.Authentication); !slices.Contains( | ||
| []string{"vars", "static_response", "invoke"}, caddy.GetModuleName(h), | ||
| ) && (auth == nil || slices.ContainsFunc( | ||
| slices.Collect(maps.Keys(auth.Providers)), | ||
| func(name string) bool { | ||
| return name != "http_basic" | ||
| }, | ||
| )) { | ||
| hdr, _ := h.(*headers.Handler) | ||
| inter, _ := h.(*intercept.Intercept) |
Contributor
There was a problem hiding this comment.
Hmm isn't there a way to just compare the json config of all the handlers? Naming all possible handlers like this feels a bit brittle
| queuedRegularThreads.Add(-1) | ||
| metrics.DequeuedRequest() | ||
| metrics.StopRequest() | ||
| return ErrNotRunning |
Contributor
There was a problem hiding this comment.
Probably makes sense to return a custom error here
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
simplest approach I could think of.
when a request is still in flight when start() calls shutdown, close the done channel and drain all queued requests, returning ErrNotRunning.
frankenphp caddy module calls requestReload, waits for the new runtime, computes a reload key (to make sure we don't accidentally introduce any security issues) and then runs it through the full new replacement route chain. If no match for the key is found, 503