FetchTreeRequests with multiple equal digests results in `Unexpected error in RPC handling`
Context
I discovered this working on buildstream/buildstream!1645.
When sending a FetchMissingBlobsRequest to buildbox-casd with multiple matching requested digests like this:
instance_name: "fe7438226bd11ea8f3f2155290d369c447f391183f971b14f9ab52d28499d935"
blob_digests {
hash: "3383d8eb3db258c160ae607cf0c9c1d7b524aaabd98ebe875a420502f07897d9"
size_bytes: 26758
}
blob_digests {
hash: "4942f12a904719e56c0c811222af665d13d2769ea0b064b1f9ce118298685601"
size_bytes: 26619
}
blob_digests {
hash: "da95ace96c52ee0634726dcda3837e9790b8774c323e0a7620d46be600c3c48e"
size_bytes: 42147
}
blob_digests {
hash: "41a1fd1acb7c41049877c20e07b539fc3caf3b9c715846ece9cfe8c47ad85217"
size_bytes: 11
}
blob_digests {
hash: "41a1fd1acb7c41049877c20e07b539fc3caf3b9c715846ece9cfe8c47ad85217"
size_bytes: 11
}
blob_digests {
hash: "971d843a74a222c22ed526b7ff8ed9fd80072ead15b2da25ce7d200c01367d6c"
size_bytes: 774
}
blob_digests {
hash: "9e0822d444e83bfa7890cbc240926603709116491bc076f0a258bfa4ac70d869"
size_bytes: 625
}
blob_digests {
hash: "6708149d23134d8787bd512d116580fb4d05f7ee9c43d82e3d22781f83f7d86c"
size_bytes: 8425
}
blob_digests {
hash: "de9d41ad411afef31488554cd359fe0145ce06aa3161a056745ad4d01819e95e"
size_bytes: 33075
}
blob_digests {
hash: "245e5a0230d0a6cd98eeaa5c79bc12c433871153d603b83b8534828c189a2f1e"
size_bytes: 145460
}
blob_digests {
hash: "c56aeac18fae2fe0d20940b6952c1618950a3be8930a1568048dfc13d34d99bd"
size_bytes: 144938
}
blob_digests {
hash: "24fdde0aee1f49666fc7a5bd7f422dc0118e4db128bc1f606f7f047c9b245bb4"
size_bytes: 23
}
blob_digests {
hash: "94818ad1a56986b47566e65982058703373cf3dc6dd6413c3cfb66662b6b16f9"
size_bytes: 145930
}
blob_digests {
hash: "94818ad1a56986b47566e65982058703373cf3dc6dd6413c3cfb66662b6b16f9"
size_bytes: 145930
}
blob_digests {
hash: "0e374139ebd4c62a296c30f2268d7d15b91dea73967d994accb2f59652027f07"
size_bytes: 7082
}
blob_digests {
hash: "314c9cfbbcf6612431c99f43a44808b22600974d63d79bcaa6d9fc1ced89243e"
size_bytes: 39991
}
blob_digests {
hash: "df6e47fc6ce5e2fd094872428d5007b9517830242632b58cd8a3c3ac33cd2310"
size_bytes: 21305
}
blob_digests {
hash: "72e6333dbac540b08eedcb57e588761b81a6d9e107789ed4da5e042fa42224a4"
size_bytes: 16981
}
blob_digests {
hash: "69f77dc5d5eed2f304a3a8e2b6bdb91c0e3eab19315562223ccd11974ceafe3d"
size_bytes: 17184
}
blob_digests {
hash: "4560c2d4466e0a2c4a9c45c7d5491ca4bc583d689cb07358c85255eaac65ac05"
size_bytes: 5336
}
blob_digests {
hash: "fa706def9c042eee226f9aa9f0805b837969de4b508f83e1d95afb31448df8a3"
size_bytes: 1708
}
blob_digests {
hash: "32df49e45a283f2ec5357d503718775c39eca930e86fc0bccd00020c069f331e"
size_bytes: 223
}
(note sha 94818ad1a56986b47566e65982058703373cf3dc6dd6413c3cfb66662b6b16f9
repeats)
The server will respond with:
"{"created":"@1575044854.245415815","description":"Error received from peer unix:/run/user/1000/buildstreamzizk_yh8/casd.sock","file":"src/core/lib/surface/call.cc","file_line":1052,"grpc_message":"Unexpected error in RPC handling","grpc_status":2}"
I believe this should not pose an isuse, and either return the same blob twice or only return it once (since the files will match), or at least give a reasonable error message, but the current behavior is confusing.
I don't have a minimal reproduction, but it should be pretty easy to reproduce. BuildStream commit 5a728ddb9e19d93797aff74d4daf4e2eb4598de7
will happily reproduce this.
Acceptance Criteria
Sending a request with multiple matching digests should not be unexpected behavior.
Edited by Tristan Maat