Skip to content

Avoid CQ drop failures #14

@kykosic

Description

@kykosic

I was running into an issue related to the Drop implementation for CompletionQueue objects. I am unsure if there is a good way to handle it, or if an API improvement can be made to avoid panic. Example:

fn main() {
    let ctx = ibverbs::devices()
        .unwrap()
        .iter()
        .next()
        .expect("no rdma device available")
        .open()
        .unwrap();

    let cq = ctx.create_cq(16, 0).unwrap();
    let pd = ctx.alloc_pd().unwrap();

    let _qp_builder = pd
        .create_qp(&cq, &cq, ibverbs::ibv_qp_type::IBV_QPT_RC)
        .build()
        .unwrap();

    // something bad happens, perhaps returning Err(...)

   
}  // CompletionQueue::Drop -> panic!

A common example of "something bad happens" is an application fails to send the serialized QueuePairEndpoint. In this case, I would like the function to return gracefully and everything resume operation. However, here the Drop of CompletionQueue will panic, I believe because the queue pair is still associated with it.

Is there any existing way to make the above drop happen gracefully?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions