problem using python-ldap under fcgi

Matt Bartolome mattxbart at
Wed Aug 27 06:32:47 CEST 2008

Hey Michael. Thank you for your response. I modified LDAPObject.c and
ldapcontrol.c to use the solution described here:

Looks like it is something specific to glibc in ubuntu and the
"recommended" use of PyObject_Del instead of PyMem_DEL. I've attached
a patch showing the modifications for anyone else ripping their hair
out. The glibc python free() error is now gone.

Now I can focus on my actual problem which I think has to do with my
python-ldap calls being blocked under fcgi. I tried compiling openldap
--without-threads thinking that it might magically work but no dice.


On Tue, Aug 26, 2008 at 12:39 AM, Michael Ströder <michael at> wrote:
> Matt Bartolome wrote:
>> I've got a little problem and I'm not sure how to track down the error
>> I'm getting. My web server is spitting back a 504 gateway timeout
>> which isn't helpful at all so I'm hoping someone here can point me in
>> the right direction.
>> When I attempt to:
>>             l = ldap.initialize(settings.AD_LDAP_URL)
>>             l.simple_bind_s(binddn,password)
>>             l.unbind_s()
>> I get the gateway timeout but this works perfectly fine in the python
>> interpreter. I'm running django as an fcgi preforked socket and
>> pointing my nginx fcgi server to it.
> As my web2ldap - based on python-ldap - runs as a FastCGI server this
> seems to work. But web2ldap is multi-threaded and does not fork when
> running as FastCGI process because of keeping the LDAP connections
> persistent.
>> All web requests work fine until
>> I hit the l.simple_bind_s() function so I'm having a heck of a time
>> finding out what the actual error is. The only other output I've been
>> able to produce is:
>> *** glibc detected *** python: free(): invalid pointer: 0x08e9b1ec ***
>> this is when I don't background the fcgi process.
> No clue especially since I don't know the Django stuff.
> Ciao, Michael.
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> _______________________________________________
> Python-LDAP-dev mailing list
> Python-LDAP-dev at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: modules.patch
Type: application/octet-stream
Size: 7741 bytes
Desc: not available
URL: <>

More information about the python-ldap mailing list