This repository was archived by the owner on Sep 30, 2024. It is now read-only.
gitserver: protobuf: relax ArchiveRequest path fields to be bytes instead of string#61970
Merged
Conversation
6e6456b to
05332a3
Compare
eseliger
approved these changes
Apr 17, 2024
…nstead of `string` commit-id:582a4b96
05332a3 to
b4adc04
Compare
Collaborator
|
The backport to To backport this PR manually, you can either: Via the sg toolUse the sg backport -r 5.3.9104 -p 61970Via your terminalTo backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-5.3.9104 5.3.9104
# Navigate to the new working tree
cd .worktrees/backport-5.3.9104
# Create a new branch
git switch --create backport-61970-to-5.3.9104
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 6a0c465fbd73943cd08e37ced457e232a40c521b
# Push it to GitHub
git push --set-upstream origin backport-61970-to-5.3.9104
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.3.9104If you encouter conflict, first resolve the conflict and stage all files, then run the commands below: git cherry-pick --continue
# Push it to GitHub
git push --set-upstream origin backport-61970-to-5.3.9104
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-5.3.9104
Once the pull request has been created, please ensure the following:
|
jdpleiness
pushed a commit
that referenced
this pull request
Apr 17, 2024
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
On customer instances and on sourcegraph.com, we get the following errors like the following from the gRPC internal error reporter:
https://cloudlogging.app.goo.gl/mLTBtcFd7w6SgBii9
{ "insertId": "94nv6f3zi8abqz6s", "jsonPayload": { "message": "grpc: error while marshaling: string field contains invalid UTF-8", "Resource": { "service.version": "269484_2024-04-17_5.3-780a5114fefa", "service.instance.id": "symbols-0", "service.name": "symbols" }, "Function": "github.com/sourcegraph/sourcegraph/internal/grpc/internalerrs.doLog", "Attributes": { "grpcCode": "Internal", "grpcService": "gitserver.v1.GitserverService", "nonUTF8StringFields": [ "paths[5]" ], "grpcMethod": "Archive" }, "Caller": "internalerrs/logging.go:239", "timestampNanos": 1713348262741927000, "InstrumentationScope": "gitserver.client.gRPC.internal.error.reporter.streamingMethod.postMessageSend" }, "resource": { "type": "k8s_container", "labels": { "project_id": "src-747bc765eb31a4873e4b", "cluster_name": "src-1b4ce535b4573846", "container_name": "symbols", "location": "us-central1", "pod_name": "symbols-0", "namespace_name": "src-f7c368f6f7282eff920c" } }, "timestamp": "2024-04-17T10:04:22.742097418Z", "severity": "ERROR", "labels": { "k8s-pod/app_kubernetes_io/component": "symbols", "k8s-pod/controller-revision-hash": "symbols-66478df6f7", "k8s-pod/app_kubernetes_io/instance": "src-bd02273f6b90d1d1beee", "k8s-pod/app": "symbols", "k8s-pod/deploy": "sourcegraph", "k8s-pod/app_kubernetes_io/name": "sourcegraph", "compute.googleapis.com/resource_name": "gke-src-1b4ce535b457-nap-n2-highmem-8-7a033d25-4tbj", "k8s-pod/statefulset_kubernetes_io/pod-name": "symbols-0" }, "logName": "projects/src-747bc765eb31a4873e4b/logs/stderr", "receiveTimestamp": "2024-04-17T10:04:25.081206904Z" }This error comes from the gitserver gRPC clients when they tries to send an ArchiveRequest
https://github.com/sourcegraph/sourcegraph/blob/22d9370786515e4c25eb20487d0a8323ecd46fdc/internal/gitserver/v1/gitserver.proto#L673-L684
In protobuf, all
stringfields must be utf-8 encoded. However, the UNIX specification says that filepaths can contain any byte sequence without NULL or/, which includes non-utf8 encoded strings.So, in order to pass this information along correctly - we need to change the type for
pathsinArchiveRequestfromstringtobytes- which allows for arbitrary byte sequences.Test plan
Existing unit tests