Issue 6585 - close is called from dap_unbind_s with fd = -1
Summary: close is called from dap_unbind_s with fd = -1
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.16
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-01 13:45 UTC by asifiqbal.desai@gmail.com
Modified: 2014-08-01 21:04 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description asifiqbal.desai@gmail.com 2010-07-01 13:45:49 UTC
Full_Name: Asif Iqbal Desai
Version: 2.4.16
OS: Solaris 10
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (130.214.64.6)


This is a consulation bug for clarification on close() being called from
ldap_unbind_s with fd = 1.

The application uses ldap client apis for user authentication.
We recently upgraded to use OpenLDAP version 2.4.16 and are getting an
unexpected AIO error issue when ldap user authentication is enabled.

Investigating further revealed that from ldap_unbind_s ( close(-1) is getting
called. However the close function of solaris libaio does a special handling
when fd < 0 which causes AIO errors.

The application needs solaris aio support and hence cannot link libc before
libaio.

Is there any specific reason for close being called with fd = -1 from
ldap_unbind_s.
This issue didnot exist with OpenLDAP 2.3.27.

Following is the stacktrace:
  [1] _libaio_close(0xffffffffffffffff, 0x2, 0x1, 0xffffffff7f300200, 0x0, 0x0),
at 0xffffffff7f406a64
  [2] sb_stream_close(0x100151d80, 0x0, 0x0, 0xffffffff7f300200, 0x0, 0x0), at
0xffffffff7d21eafc
  [3] ber_int_sb_close(0x100151d00, 0x0, 0x0, 0xffffffff7f300200, 0x0, 0x0), at
0xffffffff7d21e160
  [4] ber_sockbuf_free(0x100151d00, 0x1001497d0, 0x1, 0x1, 0xffffffff7dbad2ec,
0xd), at 0xffffffff7d21cebc
  [5] ldap_ld_free(0x100149520, 0x1, 0x0, 0x0, 0x100117020, 0xdc3), at
0xffffffff7d26a4bc
  [6] ldap_unbind_ext(0x100149520, 0x0, 0x0, 0x1001219e0, 0x1001219f8,
0x100121a00), at 0xffffffff7d26a048
  [7] ldap_unbind_s(0x100149520, 0x1001471d0, 0x100149520, 0xfffffffffffffff2,
0x0, 0x100117728), at 0xffffffff7d26a55c
...
...

Thanks in Advance,
Asif Iqbal Desai
Comment 1 asifiqbal.desai@gmail.com 2010-07-12 10:54:28 UTC
Can somebody take a look at this issue.

Note that the issue here is with close() being called from
ldap_unbind_s with fd = (-1).

Please read the first line in my original bug description email as:

This is a consulation bug for clarification on close() being called from
ldap_unbind_s with fd = -1.

Comment 2 Howard Chu 2010-07-21 14:41:42 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 3 Howard Chu 2010-07-21 21:37:43 UTC
asifiqbal.desai@gmail.com wrote:
> Full_Name: Asif Iqbal Desai
> Version: 2.4.16
> OS: Solaris 10
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (130.214.64.6)
>
>
> This is a consulation bug for clarification on close() being called from
> ldap_unbind_s with fd = 1.
>
> The application uses ldap client apis for user authentication.
> We recently upgraded to use OpenLDAP version 2.4.16 and are getting an
> unexpected AIO error issue when ldap user authentication is enabled.
>
> Investigating further revealed that from ldap_unbind_s ( close(-1) is getting
> called. However the close function of solaris libaio does a special handling
> when fd<  0 which causes AIO errors.
>
> The application needs solaris aio support and hence cannot link libc before
> libaio.
>
> Is there any specific reason for close being called with fd = -1 from
> ldap_unbind_s.
> This issue didnot exist with OpenLDAP 2.3.27.

I've checked 2.3.43 and 2.4.23; in both cases ber_int_sb_close() is being 
called twice on the same sockbuf. I suppose that might be considered a bug, 
but certainly the behavior has not changed between 2.3 and 2.4.

> Following is the stacktrace:
>    [1] _libaio_close(0xffffffffffffffff, 0x2, 0x1, 0xffffffff7f300200, 0x0, 0x0),
> at 0xffffffff7f406a64
>    [2] sb_stream_close(0x100151d80, 0x0, 0x0, 0xffffffff7f300200, 0x0, 0x0), at
> 0xffffffff7d21eafc
>    [3] ber_int_sb_close(0x100151d00, 0x0, 0x0, 0xffffffff7f300200, 0x0, 0x0), at
> 0xffffffff7d21e160
>    [4] ber_sockbuf_free(0x100151d00, 0x1001497d0, 0x1, 0x1, 0xffffffff7dbad2ec,
> 0xd), at 0xffffffff7d21cebc
>    [5] ldap_ld_free(0x100149520, 0x1, 0x0, 0x0, 0x100117020, 0xdc3), at
> 0xffffffff7d26a4bc
>    [6] ldap_unbind_ext(0x100149520, 0x0, 0x0, 0x1001219e0, 0x1001219f8,
> 0x100121a00), at 0xffffffff7d26a048
>    [7] ldap_unbind_s(0x100149520, 0x1001471d0, 0x100149520, 0xfffffffffffffff2,
> 0x0, 0x100117728), at 0xffffffff7d26a55c
> ...
> ...
>
> Thanks in Advance,
> Asif Iqbal Desai
>
>


-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 4 asifiqbal.desai@gmail.com 2010-07-28 08:50:19 UTC
Thanks a lot for looking into this issue.

On Thu, Jul 22, 2010 at 3:07 AM, Howard Chu <hyc@symas.com> wrote:
> asifiqbal.desai@gmail.com wrote:
>>
>> Full_Name: Asif Iqbal Desai
>> Version: 2.4.16
>> OS: Solaris 10
>> URL: ftp://ftp.openldap.org/incoming/
>> Submission from: (NULL) (130.214.64.6)
>>
>>
>> This is a consulation bug for clarification on close() being called from
>> ldap_unbind_s with fd = 1.
>>
>> The application uses ldap client apis for user authentication.
>> We recently upgraded to use OpenLDAP version 2.4.16 and are getting an
>> unexpected AIO error issue when ldap user authentication is enabled.
>>
>> Investigating further revealed that from ldap_unbind_s ( close(-1) is
>> getting
>> called. However the close function of solaris libaio does a special
>> handling
>> when fd<  0 which causes AIO errors.
>>
>> The application needs solaris aio support and hence cannot link libc
>> before
>> libaio.
>>
>> Is there any specific reason for close being called with fd = -1 from
>> ldap_unbind_s.
>> This issue didnot exist with OpenLDAP 2.3.27.
>
> I've checked 2.3.43 and 2.4.23; in both cases ber_int_sb_close() is being
> called twice on the same sockbuf. I suppose that might be considered a bug,
> but certainly the behavior has not changed between 2.3 and 2.4.
>
>> Following is the stacktrace:
>>   [1] _libaio_close(0xffffffffffffffff, 0x2, 0x1, 0xffffffff7f300200, 0x0,
>> 0x0),
>> at 0xffffffff7f406a64
>>   [2] sb_stream_close(0x100151d80, 0x0, 0x0, 0xffffffff7f300200, 0x0,
>> 0x0), at
>> 0xffffffff7d21eafc
>>   [3] ber_int_sb_close(0x100151d00, 0x0, 0x0, 0xffffffff7f300200, 0x0,
>> 0x0), at
>> 0xffffffff7d21e160
>>   [4] ber_sockbuf_free(0x100151d00, 0x1001497d0, 0x1, 0x1,
>> 0xffffffff7dbad2ec,
>> 0xd), at 0xffffffff7d21cebc
>>   [5] ldap_ld_free(0x100149520, 0x1, 0x0, 0x0, 0x100117020, 0xdc3), at
>> 0xffffffff7d26a4bc
>>   [6] ldap_unbind_ext(0x100149520, 0x0, 0x0, 0x1001219e0, 0x1001219f8,
>> 0x100121a00), at 0xffffffff7d26a048
>>   [7] ldap_unbind_s(0x100149520, 0x1001471d0, 0x100149520,
>> 0xfffffffffffffff2,
>> 0x0, 0x100117728), at 0xffffffff7d26a55c
>> ...
>> ...
>>
>> Thanks in Advance,
>> Asif Iqbal Desai
>>
>>
>
>
> --
>  -- Howard Chu
>  CTO, Symas Corp.           http://www.symas.com
>  Director, Highland Sun     http://highlandsun.com/hyc/
>  Chief Architect, OpenLDAP  http://www.openldap.org/project/
>

Comment 5 Quanah Gibson-Mount 2010-12-11 16:43:40 UTC
changed notes
changed state Test to Release
Comment 6 Quanah Gibson-Mount 2011-02-14 12:28:54 UTC
changed notes
changed state Release to Closed
Comment 7 OpenLDAP project 2014-08-01 21:04:30 UTC
fixed in HEAD
fixed in RE24