Skip to content

Bug: .expect() in request handlers can crash entire service #24

@drmingdrmer

Description

@drmingdrmer

Summary

Request handling code uses .expect() which will panic and crash the service on unexpected responses.

Locations

crates/service/src/meta_node/meta_handle.rs:266-268

let applied_state: AppliedState = forward_resp.try_into().expect("expect AppliedState");
let txn_reply: TxnReply = applied_state.try_into().expect("expect TxnReply");

crates/service/src/meta_node/meta_node.rs:1440

let res: AppliedState = res.try_into().expect("expect AppliedState");

Problem

These .expect() calls are in the request processing path. If the conversion fails due to:

  • Protocol version mismatch
  • Corrupted response from leader
  • Serialization bugs

The entire meta service will crash, causing complete cluster unavailability.

Impact

  • Single malformed response crashes the service
  • No graceful error handling for clients
  • Cascading failures if leader sends bad responses

Suggested Fix

let applied_state: AppliedState = forward_resp
    .try_into()
    .map_err(|e| MetaAPIError::Internal(format!("Invalid AppliedState: {:?}", e)))?;

let txn_reply: TxnReply = applied_state
    .try_into()
    .map_err(|e| MetaAPIError::Internal(format!("Invalid TxnReply: {:?}", e)))?;

Priority

P1 - Service stability

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions