Hi

[2026-06-28 17:57] "Andrea Pappacoda" <[email protected]>
> On Fri Jun 26, 2026 at 5:27 PM CEST, Philipp wrote:
> > This sounds strange, can you also print the pfd.events and pfd.revents 
> > on pre and post-poll output?
>
> Sure, here they are:
>
>     table-ldap[63446]: pre-poll,  pfd.events: 1, pfd.revents: 0
>     table-ldap[63446]: post-poll, pfd.events: 1, pfd.revents: 1
>     table-ldap[63446]: pre-poll,  pfd.events: 1, pfd.revents: 1
>
> > What might be a problem is that revents is not cleared. Can you add 
> > "pfd.revents = 0;" after the poll?
>
> pfd.revents becomes zero before the second poll, but still hangs:
>
>     table-ldap[53167]: pre-poll,  pfd.events: 1, pfd.revents: 0
>     table-ldap[53167]: post-poll, pfd.events: 1, pfd.revents: 1
>     table-ldap[53167]: pre-poll,  pfd.events: 1, pfd.revents: 0

At this point it would be intresting what is revents after the secound
poll or maybe even a few more so like 5 polls. Does the 1 reapears or
is it an other event? also I'm a bit courious how many bytes are read.

> > As a workaround you could move the fcntl for nonblocking at the end of 
> > ldap_open().
>
> I tried to, but the result is still the same:
>
>     table-ldap[31086]: pre-poll,  pfd.events: 1, pfd.revents: 0
>     table-ldap[31086]: post-poll, pfd.events: 1, pfd.revents: 1
>     table-ldap[31086]: pre-poll,  pfd.events: 1, pfd.revents: 0

This is strange, because I don't see a path how pfd.events get set
again. It's only set when read() returns EAGAIN and this only happens
on non blocking fds (acording to the docs). Have you forgotten to
rebuild or forgotten to remove the first fcntl?

If you want to have a bit more fun, attach a debugger and set a memory
watchpoint to the pfd struct. It should be only written at line 430.

Philipp

Reply via email to