How to detect a client-closed connection during a write from our LDAP server?

Andrew Bartlett abartlet at samba.org
Fri Sep 30 01:26:28 UTC 2022


I've been trying to chase down the CPU spins reported by our users in
the writev() codepath from our LDAP server.

A private mail the the strace output shows the sockets are in
CLOSE_WAIT state, returning EAGAIN over and over (after a call to
epoll() each time).  That alone would be enough to keep things
spinning.

But they are being shut down, however our LDAP server won't be
triggering a read any time soon, it is waiting to flush the response
out.

Technically even after our server OS has got the FIN, there is
potentially data in the read buffer (so a read() might not return 0
anyway), but perhaps most of the time that would be 0.

So how can we detect this?  Can we at least put a timeout on a writev()
call via tsocket et al?  If so, how do we do that?

Mailing list threads: 

https://lists.samba.org/archive/samba/2022-September/241869.html
https://lists.samba.org/archive/samba/2022-September/241873.html

Andrew Bartlett
-- 
Andrew Bartlett (he/him)       https://samba.org/~abartlet/
Samba Team Member (since 2001) https://samba.org
Samba Team Lead, Catalyst IT   https://catalyst.net.nz/services/samba

Samba Development and Support, Catalyst IT - Expert Open Source
Solutions




More information about the samba-technical mailing list