Skip to content

possible bug: duplicate completion events with the same userdata id #110

@romange

Description

@romange

Given that 'io_uring_cqe.user_data' is the only field that synchronizes completion and its submit request I assume it's very important that no completion event should return twice.

My setup: linux 5.6.2-050602-generic. I test correctness of the system under stress, simulating resource exhaustion scenarios with single thread operating io_uring with 32 depth size.

Each user_data id is unique and is set and incremented upon successful call from io_uring_get_sqe(&ring_):

sqe = io_uring_get_sqe(&ring_);
CHECK(sqe != NULL);
sqe->user_data = my_global_id++;

Upon a completion I verify user_data vs global hashset with already seen user_data ids and check-fail if it's something I already got. Very often (non-determenistically) I get a batch of completions that I've already seen.

It happens only if ring is small enough and I get EBUSY error upon io_uring_submit() call at some point. I am not sure if it's the root cause or just coincedence but I could not reproduce it with ring size 128 or more. I use IORING_OP_POLL_ADD and IORING_OP_READ with sockets (not that I think it matters).

I can attach the run log demonstrating that somehow I get a batch of completions that repeat themselves.

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