fix: stream logs for custom workers with underscores in their name - #1530
Open
geodro wants to merge 1 commit into
Open
fix: stream logs for custom workers with underscores in their name#1530geodro wants to merge 1 commit into
geodro wants to merge 1 commit into
Conversation
The log stream route validated both the site and the worker segment of
/api/worker/{site}/{worker}/logs against a lowercase alphanumeric and hyphen
pattern, but custom worker names in .lerd.yaml are free-form apart from
whitespace. A worker declared as all_queue never matched, so the request 404'd
before any stream opened and the UI sat on "Disconnected" with a Reconnect
button that could only 404 again. The worker was running the whole time, only
its logs were unreachable.
The same gate applied to the site segment, so a site handle carrying an
underscore lost every worker log pane for the same reason.
Underscores and capitals now pass. Dots, slashes and shell metacharacters still
do not, so a unit name can never walk out of the log directory it is read from.
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.
Logs for a custom worker declared in .lerd.yaml never connected when its name carried an underscore. The site log stream route validates the site and worker segments of /api/worker/{site}/{worker}/logs, and the pattern it used allowed only lowercase letters, digits and hyphens. A worker named all_queue failed that check, so the request 404'd before any stream opened, the pane fell back to "Disconnected", and Reconnect could only 404 again. The worker itself was healthy the whole time and kept processing jobs, which is why restarting it changed nothing.
Custom worker names are free-form in .lerd.yaml apart from whitespace, so the route now accepts underscores and capitals. The same gate covered the site segment, so a site handle with an underscore in it lost every worker log pane for the same reason, and that is fixed along with it.
Dots, slashes and shell metacharacters are still rejected, so a unit name resolved from a request path can never escape the log directory it is tailed from.
Refs #1527