Repository navigation
Conversation
Collaborator
|
CI Build: #45 | Passed |
Thecave3
force-pushed
the
agent-asio-epoll-fixes
branch
from
November 2, 2026 23:26
39e7b65 to
4e25b54
Compare
Collaborator
|
CI Build: #78 | Passed |
Thecave3
marked this pull request as draft
November 17, 2026 15:56
event_asio_agent() asserted on any epoll_wait() error, EINTR included.
EINTR is not an error: any signal delivered to the process interrupts the
call, and attaching a debugger or a profiler to a running gNB guarantees it.
`gdb -p <gnb pid>` aborts the whole RAN process:
epoll_wait() returned -1: errno 4, Interrupted system call
asio_agent.c:134: event_asio_agent: Assertion `0' failed.
Treat EINTR as an idle tick and return -1, which is already what the function
returns when the wait times out with no events, so the caller polls again.
Genuine errors still assert.
test/asio_agent/ interrupts the wait with SIGALRM and aborts on the unpatched
code.
Co-authored-by: Andrea Lacava <thecave003@gmail.com>
Assisted-by: Claude:claude-sonnet-5-5
Signed-off-by: Andrea Lacava <thecave003@gmail.com>
The agent wakes on the E2 SCTP socket edge-triggered (EPOLLET) and reads one message per wakeup. When two messages arrive together, the second stays in the socket buffer until a later message arrives, and the backlog never drains: each control is applied only when later ones come in. Register the E2 socket level-triggered, so the agent is woken again while unread messages remain. The internal pipe and the timers stay edge-triggered, their leftover tokens are never read. test/asio_agent/ leaves a message unread and expects a second wakeup, which the edge-triggered registration never delivers. Co-authored-by: Andrea Lacava <thecave003@gmail.com> Assisted-by: Claude:claude-sonnet-5-5 Signed-off-by: Andrea Lacava <thecave003@gmail.com>
Thecave3
force-pushed
the
agent-asio-epoll-fixes
branch
from
November 27, 2026 13:58
4e25b54 to
28c220f
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two independent fixes to the E2 agent's epoll loop (
src/agent/asio_agent.c), one commit each.1. A signal aborts the RAN process
event_asio_agent()asserts on anyepoll_wait()error,EINTRincluded.EINTRis not an error: any signal delivered to the process interrupts the call, so attaching a debugger or a profiler to a running node is enough:EINTRis now treated as an idle tick: the function returns-1, which is already what it returns when the wait times out with no events, so the caller polls again. Genuine errors still assert.2. A message can sit unread in the E2 socket
The agent registers the E2 SCTP socket edge-triggered (
EPOLLET), and the event loop reads one message per wakeup (e2ap_recv_msg_agent()once perSCTP_MSG_ARRIVED_EVENT). When two messages arrive together, the first wakeup reads one and the second stays in the socket buffer. No new arrival means no new edge, so the agent is not woken for it until a later message comes in, and the backlog never drains: each message is handled only when a later one arrives.The E2 socket is now registered level-triggered through a new
add_fd_level_asio_agent(), so the agent is woken again while unread messages remain. The internal pipe and the timers stay edge-triggered.Tests
test/asio_agent/is new, one test per commit, both#undef NDEBUGso they check in Release as well.test_asio_eintrinterrupts the wait withSIGALRMafter 100 ms. On the unpatched code it aborts with the assertion above (exit 134).test_asio_level_triggeredleaves a datagram unread on a socket pair (it keeps message boundaries like SCTP) and expects a second wakeup. Registered edge-triggered, it fails at the second wakeup.Built and tested on all three CI combinations (
E2AP_V1/KPM_V2_01,E2AP_V2/KPM_V2_03,E2AP_V3/KPM_V3_00). OnE2AP_V3the full tree builds andctestpasses 14/14 apart fromUnit_test_Agent_RIC_xAppandUnit_test_nearRT_RIC, which abort identically ondevatplugin_ric.c:187. OnE2AP_V1andE2AP_V2the agent library and the two new tests were built and run.