alibaba / alibaba/PhotonLibOS

io_uring_queue_init failed when using IORING_SETUP_SQPOLL, SQ_AFF, and COOP_TASKRUN with custom options

Open
#803 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.2k
Forks
179
Avg merge
1d 15h
Merged PRs (30d)
26

Description

Hi, I'm encountering an issue when initializing Photon with io_uring options enabled.

Here is the log output:
/////
**2025/05/31 10:15:34.596740|INFO |th=000058114BE9E970|iouring-wrapper.cpp:702|new_iouring_event_engine:Init event engine: iouring [is_master=1][setup_sqpoll=1][setup_sq_aff=1][sq_thread_cpu=2]
2025/05/31 10:15:34.596755|DEBUG|th=000058114BE9E970|reset_handle.cpp:27|ResetHandle:push [this=000058114BE89150]
2025/05/31 10:15:34.596767|INFO |th=000058114BE9E970|iouring-wrapper.cpp:557|check_register_file_support:iouring: register_files is enabled
2025/05/31 10:15:34.596791|INFO |th=000058114BE9E970|iouring-wrapper.cpp:123|init:io_uring_queue_init failed, removing IORING_SETUP_COOP_TASKRUN**
/////
My code for initializing Photon looks like this:
////

photon::PhotonOptions opts;
opts.iouring_sq_thread_cpu = 1;
opts.iouring_sq_thread_idle_ms = 10;

uint64_t event_flags = INIT_EVENT_IOURING |
INIT_EVENT_IOURING_SQPOLL |
INIT_EVENT_IOURING_SQ_AFF;

if (photon::init(event_flags, INIT_IO_NONE, opts)) {
LOG_ERROR_RETURN(0, -1, "Photon init failed");
}
DEFER(photon::fini());

////

It looks like the kernel rejects IORING_SETUP_COOP_TASKRUN, and Photon silently disables it. I'm trying to understand:
**Could someone please clarify:**
1. Why io_uring_queue_init fails with IORING_SETUP_COOP_TASKRUN?

2. Should I explicitly disable IORING_SETUP_COOP_TASKRUN, or is this fallback expected behavior?

3. Are there known kernel limitations or conflicts between SQPOLL/SQ_AFF and COOP_TASKRUN?

Thank you so much for your help!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with iouring-wrapper.cpp:123, where io_uring_queue_init failure removes IORING_SETUP_COOP_TASKRUN, then trace the related initialization and registration paths at lines 557 and 702. Reproduce the issue with the shown PhotonOptions and event flags; done means identifying whether the failure is caused by kernel or option constraints and documenting whether the fallback is expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, linux
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.