Bug 15678 - CTDB socket output queues may suffer unbounded delays under some special conditions
Summary: CTDB socket output queues may suffer unbounded delays under some special cond...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: CTDB (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-08 08:31 UTC by Xavi Hernandez
Modified: 2024-07-09 09:53 UTC (History)
3 users (show)

See Also:


Attachments
patch from master for v4.19 (2.87 KB, patch)
2024-07-08 14:38 UTC, Guenther Deschner
gd: review+
vl: review+
martins: review+
gd: ci-passed+
Details
patch from master for v4.20 (2.87 KB, patch)
2024-07-08 14:39 UTC, Guenther Deschner
gd: review+
vl: review+
martins: review+
gd: ci-passed+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xavi Hernandez 2024-07-08 08:31:06 UTC
CTDB implements asynchronous input/output queues using the tevent framework. Initially, tevent only reports EPOLLIN events when an incoming request has been received. When CTDB completes processing of the request it immediately tries to send the answer through the socket. However, if there's a lot of output data still pending to be sent through the socket and the kernel buffers are full, this may fail with EGAIN/EWOULDBLOCK. In this case, the output side of the CTDB queue is enabled and tevent is instructed to also report EPOLLOUT events.

The problem appears when both EPOLLIN and EPOLLOUT events are active at the same time. In this case the CTDB queue notification function only check EPOLLIN and ignores EPOLLOUT, so data is not really sent until EPOLLIN is not present.

In worst conditions, the input side of the queue could keep receiving requests frequently enough to always have EPOLLIN active. In that case, the pending answers in the output queue may get delayed indefinitely.
Comment 1 Xavi Hernandez 2024-07-08 08:33:45 UTC
A patch for this issue: https://gitlab.com/samba-team/samba/-/merge_requests/3688
Comment 3 Guenther Deschner 2024-07-08 14:38:56 UTC
Created attachment 18367 [details]
patch from master for v4.19
Comment 4 Guenther Deschner 2024-07-08 14:39:53 UTC
Created attachment 18368 [details]
patch from master for v4.20
Comment 5 Jule Anger 2024-07-09 07:49:49 UTC
Pushed to autobuild-v4-{20,19}-test.
Comment 6 Samba QA Contact 2024-07-09 08:47:04 UTC
This bug was referenced in samba v4-19-test:

6107f663046a7a762d1c35beeaae0c1b46582f2e
Comment 7 Samba QA Contact 2024-07-09 09:44:04 UTC
This bug was referenced in samba v4-20-test:

63b47dc0edcd0a1ffe53dd083249d3e9029f4e62
Comment 8 Jule Anger 2024-07-09 09:53:42 UTC
Closing out bug report.

Thanks!