[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldap_result(), Posix signals and error checking



> Quanah Gibson-Mount wrote:
>> --On Saturday, September 05, 2009 5:58 PM +0200 John Miller
>> <johnmiller@email.it>  wrote:
>>
>>> Hi all,
>>> I have noticed a problem with my program (which is supposed to generate
>>> and  receive many Posix signals ) and the function ldap_result(). It
>>> happened to both my code and those library functions that used it (the
>>> synchronous versions of  various add/search/modify functions).
>>> They all failed randomly with a "Can't contact LDAP server" error. I
>>> tracked the issue down to the poll() function in os-ip.c : it's return
>>> value is not checked to see if  it has been interrupted by a signal.
>>> Patching the library ( making the poll function to restart if errno ==
>>> EINTR after failure ), resolved my problem.
>>>
>>> Is it a bug or a choice? The patch is trivial, but if that error is not
>>> checked by choice that should be documented imho.
>>
>> I would send a question like this to openldap-devel@openldap.org
>
> And it would be ignored. This is the right list for this question.
>
> But the original poster appears to be confused. ldap_int_poll() clearly
> checks
> for EINTR already.
>
> --
>    -- Howard Chu
>    CTO, Symas Corp.           http://www.symas.com
>    Director, Highland Sun     http://highlandsun.com/hyc/
>    Chief Architect, OpenLDAP  http://www.openldap.org/project/

If you have defined HAVE_POLL, ldap_int_select
uses poll().
The only EINTR check I see on that error is one function away, but
it works, if I am correct, if I use ldap_set_option() to set
LDAP_OPT_RESTART to LDAP_OPT_ON.
I can't check right nowif it solves my problem, though.
Would it be the correct solution to make ldap_int_select restart?

Cheers,
JM