On Wed, Feb 27, 2019 at 3:57 AM Tom Lane <tgl@xxxxxxxxxxxxx> wrote: > Thomas Munro <thomas.munro@xxxxxxxxx> writes: > > Question > > for the list: other stuff in the server needs libpthread (SSL, LLVM, > > ...), so why are we insisting on using non-MT LDAP? > > The traditional reason for avoiding that is the risk of a server > process becoming multi-threaded. There are live bugs of that ilk > on Darwin, and we actually have cross-checks for the case in our > code (see HAVE_PTHREAD_IS_THREADED_NP stanzas). > > If pthread_is_threaded_np(), or something equivalent, is widely available > then it might be all right to try solving this going forward by switching > to libldap_r and seeing if anyone hits those cross-checks. I'd be afraid > to risk it in the back branches though ... Hmm. Well here is a new data point: it looks like the Red Hat family of distributions is in the process of making the same decision as Debian (namely: to expunge the non-MT variant, because it bites various projects in the same way that it bites us), but they haven't quite hasn't pulled the trigger yet: https://fedoraproject.org/wiki/Changes/OpenLDAPwithoutNonthreadedLibraries So if we do nothing at all, it seems likely that this problem will eventually go away by itself on practically all Linux systems, leaving this unfixed LDAP vs postgres_fdw bug to trip up the other Unix systems. Bleugh. I don't see pthread_is_threaded_np() on any non-Apple systems in my lab. Clearly libdap_r is *capable* of creating threads: it contains a function ldap_pvt_thread_create(), and we can see that slapd and other OpenLDAP things use that, but AFAICT that's a private facility not intended for end users to call, so there's no danger if you just use the documented LDAP client API. Since pthread_is_threaded_np() is a Mac thing, note also that Macs aren't directly exposed to this particular choice anyway because (at least if you use system-provided libraries rather than MacPorts et al) libldap.dylib and libldap_r.dylib are already symlinks to the same Apple voodoo "/System/Library/Frameworks/LDAP.framework/Versions/A/LDAP". -- Thomas Munro https://enterprisedb.com