Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dstack/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dstack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ x509-parser = "0.16.0"
pkcs8 = { version = "0.10", default-features = false }

# RPC/Protocol
prpc = "0.6.0"
prpc-build = "0.6.1"
prpc = "0.6.2"
prpc-build = "0.7.0"
Comment on lines +264 to +265

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, this was a real runtime break and my compile checks could not have caught it — serde_json::from_slice::<()> type-checks fine and only fails on the empty input at run time.

Fixed in 9887987: PrpcClient now decodes through prpc::codec::decode_json_from_slice as well. There are exactly two RequestClient impls in the tree (ra-rpc::RaClient and http-client::PrpcClient); both are updated now, and I left a comment at each call site so a future edit does not quietly revert to serde_json::from_slice.


# Development/Testing
bindgen = "0.71.1"
Expand Down
5 changes: 4 additions & 1 deletion dstack/http-client/src/prpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ impl RequestClient for PrpcClient {
if status != 200 {
anyhow::bail!("Invalid status code: {status}, path={path}");
}
let response = serde_json::from_slice(&body).context("Failed to deserialize response")?;
// Not serde_json::from_slice: a unit response arrives as an empty body, which
// is not valid JSON. Every RequestClient impl has to decode through this.
let response =
prpc::codec::decode_json_from_slice(&body).context("Failed to deserialize response")?;
Ok(response)
}
}
5 changes: 4 additions & 1 deletion dstack/ra-rpc/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ impl RequestClient for RaClient {
.await
.context("Failed to read response")?
.to_vec();
let response = serde_json::from_slice(&body).context("Failed to deserialize response")?;
// Not serde_json::from_slice: a unit response arrives as an empty body, which
// is not valid JSON. Every RequestClient impl has to decode through this.
let response =
prpc::codec::decode_json_from_slice(&body).context("Failed to deserialize response")?;
Ok(response)
}
}
Loading