URL:
https://github.com/SSSD/sssd/pull/5532
Title: #5532: Handle ldap_install_tls() configuration and retrial
alexey-tikhonov commented:
"""
> > > **Wrt 1st patch**
>
> Why did we see poll() previously?
We saw and still see poll(), but not for the authentication handshake sequence. Without
any of the options set poll() is used for some part of the communication. This part of the
communication is the same one that uses poll() when any of the options is set.
I don't think so.
https://bugzilla.redhat.com/show_bug.cgi?id=1839972#c130 (sorry for the private link) :
```
04:45:50.443947 fcntl(23, F_GETFL) = 0x2 (flags O_RDWR) <0.000009>
04:45:50.443984 fcntl(23, F_SETFL, O_RDWR|O_NONBLOCK) = 0 <0.000009>
04:45:50.444071 write(23, "\26\...", 289) = 289 <0.000032>
04:45:50.444142 read(23, 0x55c5711ef360, 7) = -1 EAGAIN (Resource temporarily unavailable)
<0.000011>
04:45:50.444190 poll([{fd=23, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 12000) = ?
ERESTART_RESTARTBLOCK (Interrupted by signal) <1.771686>
```
If this is not a part of a handshake then please tell me what is it?
> Probably because it requires both ASYNC && (TIMEOUT !=
0).
No, I set both options and read() is still used for the authentication handshake.
Of course, `read()` is required. After all, you need to get the data from the socket
eventually :)
Let me please remind a main purpose of this "settings game".
The purpose was to figure out if using `LDAP_OPT_CONNECT_ASYNC` helps to avoid removal of
`O_NONBLOCK` flag from our socket.
The idea was that if we would preserve `O_NONBLOCK` then we wouldn't need
`SO_RCVTIMEO/SO_SNDTIMEO` socket options that were identified as a cause of ERESTARTSYS
-> EINTR change (that is an immediate cause of the ticket).
But, as strace you provided in
https://bugzilla.redhat.com/show_bug.cgi?id=1839972#c129
shows, `_ASYNC` replaces blocking `read()` with timed `poll()` (and frankly this is quite
expected).
And unfortunately `poll()` is one of
```
"interfaces are never restarted after being
interrupted by a signal handler, regardless of the use of
SA_RESTART; they always fail with the error EINTR when
interrupted by a signal handler"
```
(signal(7) man page)
At this point I've got an answer for my initial proposal and I personally don't
see a reason to touch any settings to resolve this specific ticket.
But you wrote:
I'm having doubts with the usage of LDAP_OPT_NETWORK_TIMEOUT
option, as in this case read() fails with EAGAIN instead of EINTR and ldap_install_tls()
doesn't fail. Maybe openldap handles the retry in this case but I need to take a
closer look.
This is interesting. Could you please quote corresponding strace or at least point to a
specific log that exhibits this behavior?
As I pointed out previously, SSSD already sets `LDAP_OPT_NETWORK_TIMEOUT`. Setting the
same option in different places needs an explanation.
"""
See the full comment at
https://github.com/SSSD/sssd/pull/5532#issuecomment-800964115