curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: multi_wait blocks on sread (recv)

From: Daniel Stenberg via curl-library <>
Date: Thu, 9 Sep 2021 09:50:32 +0200 (CEST)

On Wed, 8 Sep 2021, William Smith via curl-library wrote:


I took a casual look at the diff between 7.50.0 and master, and the
lib/openldap.c file actually hasn't changed *that* much but I also didn't spot
anything obvious that can explain what you describe.

Also, LDAP is certainly not the most used protocol in the curl family and also
not the most widely tested one, which increase the risk that you've ran into a
bug not previously seen.

libcurl should *always* set all sockets it uses to non-blocking mode, which
should make any blocking problem within libcurl itself.

> I fixed the block before the sread in multi_wait by using a nonblocking
> pselect before the sread.

The block before the sread? The sread() call in multi_wait() is for reading
the wakeup socketpair, it shouldn't be specific to ldap at all?

The reading of ldap data should be done in oldap_recv() as I understand it.

> The infinite while loop around the sread call depends on an external
> condition, which seems pretty weak to me.

Which infinite while loop is this?

> instead of breaking out of
> the blocking sread, I get a SEGV in ldapsb_tls_write (openldap.c), at this
> line:
> ret = (li->send)(data, FIRSTSOCKET, buf, len, &err)

A(nother) bug then clearly. We welcome patches/pull-requests!

  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
Received on 2021-09-09