jonhoo / rust-ibverbs

Bindings for RDMA ibverbs through rdma-core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid CQ drop failures

kykosic opened this issue · comments

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?

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.

I have noticed this as well. I have been debugging it a bit (this issue is one of the reasons I am working on #13).