« Previous Next »

Thread: LDAP IIS 6 Problem

Last post 10-19-2007 2:00 AM by shp1979. 10 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (11 items)

Sort Posts:

  • 10-09-2007, 6:56 PM

    • shp1979
    • Not Ranked
    • Joined on 10-09-2007, 6:48 PM
    • Posts 5

    LDAP IIS 6 Problem

    Hi, 

    I am trying to query an LDAP server to fetch user password expiration details. We want to show a warning message if this user's password is about to expire. The application works fine for some time (varying from 5 - 6 login attempts to 25 -30 login attempts) and then w3wp starts consuming 25% of CPU and eventually stops responding to any request. In my code (C#), I am disposing all LDAP related objects in finally block. I have also added some timeouts (LDAP client and server timeouts) to make sure that application won’t wait if the LDAP server is not responding in a reasonable time. I also tried to run iisstate to see what all threads are running but couldn’t identify anything significant from that information ( I don’t have good knowledge of how to debug stack trace information generated by the iisstate). So, right now I have no clue about what is going wrong.
     

    I checked the threads that were running in w3wp process when it started consuming 25% CPU time. There was one thread msvcrt.dll!endthread that was eating up 25% CPU time.

    I am not sure what this thread does. I also saw couple of other threads like ntdll.dll! RtlOpenCurrentUser and I am not sure how/whether they are related.

    I wonder if anyone can help to understand what are msvcrt.dll ntdll.dll and w3tp.dl processes and how they are used by w3wp( if they are used by w3wp process). What is RtlOpenCurrentUser in ntdll.dll

    I am sending the stack trace generated by iisstate. Please let me know if you figured out something from this trace.
     

    *********************** 

    Symbol search path is: SRV*C:\iisstate\symbols*http://msdl.microsoft.com/download/symbols

     

    Microsoft (R) Windows Debugger  Version 6.2.0013.1

    Copyright (c) Microsoft Corporation. All rights reserved.

     

    *** wait with pending attach

    Symbol search path is: SRV*C:\iisstate\symbols*http://msdl.microsoft.com/download/symbols

    Executable search path is:

    WARNING: Process 4532 is not attached as a debuggee

             The process can be examined but debug events will not be received

    .........................................................................................................................................

    The call to LoadLibrary(exts) failed, Win32 error 2

        "The system cannot find the file specified."

    Please check your debugger configuration and/or network access.

    (11b4.774): Wake debugger - code 80000007 (first chance)

    Opened log file 'C:\iisstate\output\IISState-4532.log'

     

    ***********************

    Starting new log output

    IISState version 3.3.1

     

    Tue Oct 09 11:47:14 2007

     

    OS = Windows 2003 Server

    Executable: w3wp.exe

    PID =  4532

     

    Note: Thread times are formatted as HH:MM:SS.ms

     

    ***********************

     

     

     

     

    Thread ID: 0

    System Thread ID: 774

    Kernel Time: 0:0:0.31

    User Time: 0:0:0.109

    Thread Status: Thread is in a WAIT state.

    Thread Type: HTTP Compression Thread

     # ChildEBP RetAddr 

    00 0006fc08 7c827d0b ntdll!KiFastSystemCallRet

    01 0006fc0c 77e61d1e ntdll!NtWaitForSingleObject+0xc

    02 0006fc7c 77e61c8d kernel32!WaitForSingleObjectEx+0xac

    03 0006fc90 5a364662 kernel32!WaitForSingleObject+0x12

    04 0006fca0 5a366e3f w3dt!WP_CONTEXT::RunMainThreadLoop+0x10

    05 0006fca8 5a3af42d w3dt!UlAtqStartListen+0x2d

    06 0006fcb8 5a3bc335 w3core!W3_SERVER::StartListen+0xbd

    07 0006ff0c 0100187c w3core!UlW3Start+0x26e

    08 0006ff44 01001a27 w3wp!wmain+0x22a

    09 0006ffc0 77e6f23b w3wp!wmainCRTStartup+0x12f

    0a 0006fff0 00000000 kernel32!BaseProcessStart+0x23

     

     

     

     

    Thread ID: 1

    System Thread ID: 3a4

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Type: Other

     # ChildEBP RetAddr 

    00 00ccff9c 7c826f4b ntdll!KiFastSystemCallRet

    01 00ccffa0 7c83d424 ntdll!NtDelayExecution+0xc

    02 00ccffb8 77e64829 ntdll!RtlpTimerThread+0x47

    03 00ccffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 2

    System Thread ID: 17f4

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Type: Other

     # ChildEBP RetAddr 

    00 00d0ff70 7c8277db ntdll!KiFastSystemCallRet

    01 00d0ff74 7c839f38 ntdll!ZwRemoveIoCompletion+0xc

    02 00d0ffb8 77e64829 ntdll!RtlpWorkerThread+0x3d

    03 00d0ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 3

    System Thread ID: 1ab8

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Type: Possible ASP page.  Possible DCOM activity

    Executing Page: Unable to locate ASP page

     

    No remote call being made

     

     # ChildEBP RetAddr 

    00 00d7fe18 7c82783b ntdll!KiFastSystemCallRet

    01 00d7fe1c 77c885ac ntdll!NtReplyWaitReceivePortEx+0xc

    02 00d7ff84 77c88792 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x198

    03 00d7ff8c 77c8872d RPCRT4!RecvLotsaCallsWrapper+0xd

    04 00d7ffac 77c7b110 RPCRT4!BaseCachedThreadRoutine+0x9d

    05 00d7ffb8 77e64829 RPCRT4!ThreadStartRoutine+0x1b

    06 00d7ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 4

    System Thread ID: 1aa0

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Type: HTTP Listener

     # ChildEBP RetAddr 

    00 00f7ff24 7c8277db ntdll!KiFastSystemCallRet

    01 00f7ff28 77e5bea2 ntdll!ZwRemoveIoCompletion+0xc

    02 00f7ff54 5a30248e kernel32!GetQueuedCompletionStatus+0x29

    03 00f7ff8c 5a3026ac W3TP!THREAD_POOL_DATA::ThreadPoolThread+0x33

    04 00f7ffa0 5a301da9 W3TP!THREAD_POOL_DATA::ThreadPoolThread+0x24

    05 00f7ffb8 77e64829 W3TP!THREAD_MANAGER::ThreadManagerThread+0x39

    06 00f7ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 5

    System Thread ID: b30

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Type: HTTP Listener

     # ChildEBP RetAddr 

    00 00fbff24 7c8277db ntdll!KiFastSystemCallRet

    01 00fbff28 77e5bea2 ntdll!ZwRemoveIoCompletion+0xc

    02 00fbff54 5a30248e kernel32!GetQueuedCompletionStatus+0x29

    03 00fbff8c 5a3026ac W3TP!THREAD_POOL_DATA::ThreadPoolThread+0x33

    04 00fbffa0 5a301da9 W3TP!THREAD_POOL_DATA::ThreadPoolThread+0x24

    05 00fbffb8 77e64829 W3TP!THREAD_MANAGER::ThreadManagerThread+0x39

    06 00fbffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 6

    System Thread ID: 1760

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.15

    Thread Type: HTTP Listener

     # ChildEBP RetAddr 

    00 00ffff24 7c8277db ntdll!KiFastSystemCallRet

    01 00ffff28 77e5bea2 ntdll!ZwRemoveIoCompletion+0xc

    02 00ffff54 5a30248e kernel32!GetQueuedCompletionStatus+0x29

    03 00ffff8c 5a3026ac W3TP!THREAD_POOL_DATA::ThreadPoolThread+0x33

    04 00ffffa0 5a301da9 W3TP!THREAD_POOL_DATA::ThreadPoolThread+0x24

    05 00ffffb8 77e64829 W3TP!THREAD_MANAGER::ThreadManagerThread+0x39

    06 00ffffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 7

    System Thread ID: 520

    Kernel Time: 0:0:0.46

    User Time: 0:0:0.0

    Thread Type: HTTP Listener

     # ChildEBP RetAddr 

    00 0104ff24 7c8277db ntdll!KiFastSystemCallRet

    01 0104ff28 77e5bea2 ntdll!ZwRemoveIoCompletion+0xc

    02 0104ff54 5a30248e kernel32!GetQueuedCompletionStatus+0x29

    03 0104ff8c 5a3026ac W3TP!THREAD_POOL_DATA::ThreadPoolThread+0x33

    04 0104ffa0 5a301da9 W3TP!THREAD_POOL_DATA::ThreadPoolThread+0x24

    05 0104ffb8 77e64829 W3TP!THREAD_MANAGER::ThreadManagerThread+0x39

    06 0104ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 8

    System Thread ID: b68

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Status: Thread is in a WAIT state.

    Thread Type: Other

     # ChildEBP RetAddr 

    00 0110fcec 7c827cfb ntdll!KiFastSystemCallRet

    01 0110fcf0 7c83c78e ntdll!NtWaitForMultipleObjects+0xc

    02 0110ffb8 77e64829 ntdll!RtlpWaitThread+0x161

    03 0110ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 9

    System Thread ID: 220

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Status: Thread is in a WAIT state.

    Thread Type: HTTP Compression Thread

     # ChildEBP RetAddr 

    00 01adfa84 7c827d0b ntdll!KiFastSystemCallRet

    01 01adfa88 77e61d1e ntdll!NtWaitForSingleObject+0xc

    02 01adfaf8 77e61c8d kernel32!WaitForSingleObjectEx+0xac

    03 01adfb0c 5a3b820f kernel32!WaitForSingleObject+0x12

    04 01adffb8 77e64829 w3core!HTTP_COMPRESSION::CompressionThread+0x126

    05 01adffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 10

    System Thread ID: 1054

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Type: Possible ASP page.  Possible DCOM activity

    Executing Page: Unable to locate ASP page

     

    No remote call being made

     

     # ChildEBP RetAddr 

    00 01b1fe18 7c82783b ntdll!KiFastSystemCallRet

    01 01b1fe1c 77c885ac ntdll!NtReplyWaitReceivePortEx+0xc

    02 01b1ff84 77c88792 RPCRT4!LRPC_ADDRESS::ReceiveLotsaCalls+0x198

    03 01b1ff8c 77c8872d RPCRT4!RecvLotsaCallsWrapper+0xd

    04 01b1ffac 77c7b110 RPCRT4!BaseCachedThreadRoutine+0x9d

    05 01b1ffb8 77e64829 RPCRT4!ThreadStartRoutine+0x1b

    06 01b1ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 11

    System Thread ID: 19ac

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Type: Other

     # ChildEBP RetAddr 

    00 01b5ff8c 7c826f4b ntdll!KiFastSystemCallRet

    01 01b5ff90 7c81943a ntdll!NtDelayExecution+0xc

    02 01b5ffb8 77e64829 ntdll!RtlpIOWorkerThread+0x3f

    03 01b5ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 12

    System Thread ID: b24

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Status: Thread is in a WAIT state.

    Thread Type: ASP

    Executing Page: Unable to locate ASP page

     

     # ChildEBP RetAddr 

    00 0275ff0c 7c827d0b ntdll!KiFastSystemCallRet

    01 0275ff10 77e61d1e ntdll!NtWaitForSingleObject+0xc

    02 0275ff80 77e61c8d kernel32!WaitForSingleObjectEx+0xac

    03 0275ff94 709fc803 kernel32!WaitForSingleObject+0x12

    04 0275ffb4 709fc7db asp!CApplnCleanupMgr::ApplnCleanupDoWork+0x1e

    05 0275ffb8 77e64829 asp!CApplnCleanupMgr::ApplnCleanupThread+0xa

    06 0275ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 13

    System Thread ID: 1d64

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Status: Thread is in a WAIT state.

    Thread Type: ASP

    Executing Page: Unable to locate ASP page

     

     # ChildEBP RetAddr 

    00 02a1fe1c 7c827cfb ntdll!KiFastSystemCallRet

    01 02a1fe20 77e6202c ntdll!NtWaitForMultipleObjects+0xc

    02 02a1fec8 7739bbd1 kernel32!WaitForMultipleObjectsEx+0x11a

    03 02a1ff24 7739ce36 USER32!RealMsgWaitForMultipleObjectsEx+0x141

    04 02a1ff40 709fb8be USER32!MsgWaitForMultipleObjects+0x1f

    05 02a1ff84 77bcb530 asp!CMTACallbackThread::Thread+0x4f

    06 02a1ffb8 77e64829 msvcrt!_endthreadex+0xa3

    07 02a1ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 14

    System Thread ID: ba4

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Status: Thread is in a WAIT state.

    Thread Type: ASP

    Executing Page: Unable to locate ASP page

     

     # ChildEBP RetAddr 

    00 0318fef4 7c827d0b ntdll!KiFastSystemCallRet

    01 0318fef8 77e61d1e ntdll!NtWaitForSingleObject+0xc

    02 0318ff68 77e61c8d kernel32!WaitForSingleObjectEx+0xac

    03 0318ff7c 709fe8ef kernel32!WaitForSingleObject+0x12

    04 0318ffb8 77e64829 asp!CViperReqManager::WatchThread+0x68

    05 0318ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 15

    System Thread ID: 15e0

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Status: Thread is in a WAIT state.

    Thread Type: Idle ASP thread

     # ChildEBP RetAddr 

    00 0321fee8 7c827d0b ntdll!KiFastSystemCallRet

    01 0321feec 77e61d1e ntdll!NtWaitForSingleObject+0xc

    02 0321ff5c 77e61c8d kernel32!WaitForSingleObjectEx+0xac

    03 0321ff70 4a77921b kernel32!WaitForSingleObject+0x12

    04 0321ff84 77bcb530 comsvcs!CSTAThreadPool::LoadBalanceThreadControlLoop+0x29

    05 0321ffb8 77e64829 msvcrt!_endthreadex+0xa3

    06 0321ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 16

    System Thread ID: 156c

    Kernel Time: 0:0:0.0

    User Time: 0:0:0.0

    Thread Status: Thread is in a WAIT state.

    Thread Type: Idle ASP thread

     # ChildEBP RetAddr 

    00 0325fee0 7c827d0b ntdll!KiFastSystemCallRet

    01 0325fee4 77e61d1e ntdll!NtWaitForSingleObject+0xc

    02 0325ff54 77e61c8d kernel32!WaitForSingleObjectEx+0xac

    03 0325ff68 4a778cb6 kernel32!WaitForSingleObject+0x12

    04 0325ff84 77bcb530 comsvcs!CSTAThreadPool::KillThreadControlLoop+0x25

    05 0325ffb8 77e64829 msvcrt!_endthreadex+0xa3

    06 0325ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 17

    System Thread ID: f2c

    Kernel Time: 0:0:0.78

    User Time: 0:0:0.328

    Thread Status: Thread is in a WAIT state.

    Thread Type: Idle ASP thread

     # ChildEBP RetAddr 

    00 0329fdcc 7c827cfb ntdll!KiFastSystemCallRet

    01 0329fdd0 77e6202c ntdll!NtWaitForMultipleObjects+0xc

    02 0329fe78 7739bbd1 kernel32!WaitForMultipleObjectsEx+0x11a

    03 0329fed4 7739ce36 USER32!RealMsgWaitForMultipleObjectsEx+0x141

    04 0329fef0 4a77cb28 USER32!MsgWaitForMultipleObjects+0x1f

    05 0329ff84 77bcb530 comsvcs!CSTAThread::WorkerLoop+0x1f9

    06 0329ffb8 77e64829 msvcrt!_endthreadex+0xa3

    07 0329ffec 00000000 kernel32!BaseThreadStart+0x34

     

     

     

     

    Thread ID: 18

    System Thread ID: 1ab0

    Kernel Time: 0:0:3.406

    User Time: 0:0:25.843

    *** WARNING: Unable to verify checksum for C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.DirectorySer#\54bf4abd12c4a168968605947cbd7006\System.DirectoryServices.ni.dll

    Thread Type: Other

     # ChildEBP RetAddr 

    00 0336c430 76f17bbc WLDAP32!DrainWinsock+0x116

    01 0336c47c 76f19f1c WLDAP32!LdapWaitForResponseFromServer+0x2e0

    02 0336c804 76f19cf5 WLDAP32!LdapExchangeOpaqueToken+0x363

    03 0336c8bc 76f1993f WLDAP32!LdapSspiBind+0x372

    04 0336cc6c 76f1a5cc WLDAP32!LdapBind+0x3a2

    05 0336cc94 76dc467d WLDAP32!ldap_bind_sW+0x2c

    06 0336cce0 76dc4410 adsldpc!LdapBindS+0xe4

    07 0336cd0c 76dc42fe adsldpc!LdapOpenBindWithDefaultCredentials+0x18d

    08 0336d174 76dc379f adsldpc!LdapOpenObject2+0x128

    09 0336d194 712d3e32 adsldpc!LdapOpenObject+0x1b

    0a 0336d1c4 712d3d6d adsldp!CLDAPRootDSE::CreateRootDSE+0x97

    0b 0336d1f4 712d4828 adsldp!GetRootDSEObject+0x51

    0c 0336d468 712d284c adsldp!GetServerBasedObject+0x11b

    0d 0336d8c0 712d52f3 adsldp!GetObjectW+0x69

    0e 0336d8ec 76df1bbb adsldp!CLDAPNamespace::OpenDSObject+0x34

    0f 0336d944 03c5bf9c activeds!ADsOpenObject+0xb2

    WARNING: Frame IP not in any known module. Following frames may be wrong.

    10 0336d9e4 67170d73 0x3c5bf9c

    11 0336da40 671663ae System_DirectoryServices_ni+0x10d73

    12 0336daa8 67166245 System_DirectoryServices_ni+0x63ae

    13 0336dab8 67165870 System_DirectoryServices_ni+0x6245

    14 0336dac8 6716d0fa System_DirectoryServices_ni+0x5870

    15 04d1101c 03dba1d8 System_DirectoryServices_ni+0xd0fa

    16 03dcb004 00000001 0x3dba1d8

     

     

     

     

    Thread ID: 19

    System Thread ID: 12d4

    Kernel Time: 0:0:0.78

    User Time: 0:0:0.234

    Thread Status: Thread is in a WAIT

    ***********************

     

    More information about my system

    Machine: windows 2003 SP2

    IIS: IIS 6

    Application: classical ASP application using C# COM object to query the LDAP server. C# code is using System.DirectoryServices library and is running under .Net 2.0 framework.

    I will really appreciate your help.
     

    Thanks,

    Sushil

  • 10-09-2007, 10:22 PM In reply to

    Re: LDAP IIS 6 Problem

    I would query a specific DC with an account that has permissions to query AD. Generally this account needs to be a domain admin.  Does your code pass credentials that are an AD domain admin or Administrator?  Or does your application pool account have permissions AD. 

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-09-2007, 10:25 PM In reply to

    Re: LDAP IIS 6 Problem

    http://weblogs.asp.net/steveschofield/archive/2004/04.aspx has two posts how to pass credentials when querying / connecting to AD.

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-10-2007, 12:40 AM In reply to

    • shp1979
    • Not Ranked
    • Joined on 10-09-2007, 6:48 PM
    • Posts 5

    Re: LDAP IIS 6 Problem

    Hi Steve, no i am not passing credentials but the application pool account has permissions on AD. Thing is, the application works fine for first few minutes. It is able to connect to AD and able to get information like password age policy and last password change date etc. So i think it is not a permission issue otherwise it would have break on it's first query itself. I am also using IP address of AD server instead of its DNS name to make sure that DNS resolution is failing. I am using object locks around the LDAP code. So probably it's not because of simultaneous access of some object/connection.

    Let me know if you need any other information.

    Thanks,

    Sushil 

     

     

  • 10-10-2007, 1:15 AM In reply to

    Re: LDAP IIS 6 Problem

    Then it sounds more like a timeout issue or something related.  Do you see anything on the domain controllers?  Once ADSI breaks the connection, your code could be spinning trying to connect on a broken connection much like when connecting to a DB.  I would use a network sniffer to watch the traffic between the web server and a specific DC, see if port 389 calls are going back and forth.

    http://support.microsoft.com/kb/315071  this has some AD related timeouts, max's and such.

     

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-10-2007, 2:35 AM In reply to

    • shp1979
    • Not Ranked
    • Joined on 10-09-2007, 6:48 PM
    • Posts 5

    Re: LDAP IIS 6 Problem

    Yes, that might be causing problem. I will monitor network connections and see whether there are any pending connections.I actually had used netstat on my web server to see whether there are any active connections to the LDAP server. Most of the times it was showing TIME_WAIT connections with the ldap server, which I think is ok. For few times it showed CLOSE_WAIT on ldap connections. I saw this few times when w3wp process stopped responding but it doesn’t happen always. Another thing I saw is an UDP connection to *.* from my web server. This connection always remains there and for some reason if we loose this connection, I think that’s another time when w3wp process stops responding. It does try to connect to LDAP server but not sure whether it gets any response or not. Sometimes w3wp process gets recycled after being in a loop for some time and the new w3wp process works fine. I checked the event logs when w3wp process was recycled but didn’t find anything useful there.

    There are couples of other things that we observed that you might find intereting. We observed that all browsers from one machine were waiting for response from the server while the browsers on another machine were working fine.Then after some time even those browsers went into a wait state. So is it possible that w3wp would decide not to respond to all request coming from a machine(or for a session) and servers other machines properly. Is it like w3wp allocates one thread for a session and all request from that session/machine goes to only that thread.

    Sometime we also get TNS protocol adaptor invalid error at the same time on some other pages. It fails to make database connection! So I am not sure whether the problem is with LDAP or its IIS that is causing problem. I don’t see the database error if the LDAP feature is turned off. So again, it tells me that it's an LDAP issue.

    Does  ADSI retains the connection with LDAP server even after LDAP objects are disposed? Then if that connection is broken or closed then isn’t ADSI supposed to make a new connection when it gets a new LDAP query request? Please explain. I will try to see what parameters are defined on our LDAP server. I will get back to you if I find something.Thanks,Sushil

     

  • 10-12-2007, 8:45 PM In reply to

    • shp1979
    • Not Ranked
    • Joined on 10-09-2007, 6:48 PM
    • Posts 5

    Re: LDAP IIS 6 Problem

    I got this stack trace for the thread that was hanging...

     

    ntkrnlpa.exe+0x8dace
    ntkrnlpa.exe+0x29a62
    ntkrnlpa.exe+0x33178
    hal.dll+0x6199
    hal.dll+0x63d9
    hal.dll+0x6577
    hal.dll+0x3902
    hal.dll+0x60b4
    ntkrnlpa.exe+0xf5c89
    ntkrnlpa.exe+0xeed08
    ntkrnlpa.exe+0x8978c
    ntdll.dll!KiFastSystemCallRet
    WS2_32.dll!select+0xa1
    WLDAP32.dll!LdapUTF8ToUnicode+0xc2f
    WLDAP32.dll!LdapUTF8ToUnicode+0x1116
    WLDAP32.dll!LdapUTF8ToUnicode+0x1488
    WLDAP32.dll!ldap_search_ext_sW+0x7c
    WLDAP32.dll!ldap_search_stW+0x44
    WLDAP32.dll!ldap_search_sW+0x21
    adsldpc.dll!LdapAttributeFree+0x42
    adsldpc.dll!LdapSearchS+0x26
    adsldp.dll!DllGetClassObject+0x21be
    adsldp.dll!DllGetClassObject+0x118d
    adsldp.dll!DllGetClassObject+0x1986e
    mscorwks.dll!DllGetClassObjectInternal+0x89f8
    System.DirectoryServices.ni.dll+0xd109

     

    any idea what it is waiting for ??

     

    -sushil 

     

  • 10-13-2007, 11:03 AM In reply to

    Re: LDAP IIS 6 Problem

    I would review the code related to the LDAP search, make sure it can return the results in-time.  That is the only thing that stands out. 

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-15-2007, 5:03 PM In reply to

    • mmaddox0
    • Not Ranked
    • Joined on 10-15-2007, 9:00 PM
    • Posts 1

    Re: LDAP IIS 6 Problem

    I'm getting same error but for a non-IIS program.  My dll is called first.dll and it seems to be enlessly looping or something within the ntkrnlpa.exe

    ntkrnlpa.exe+0x8dace
    ntkrnlpa.exe+0x29a62
    ntkrnlpa.exe+0x33178
    hal.dll+0x6199
    hal.dll+0x63d9
    hal.dll+0x6577
    hal.dll+0x3902
    first.dll!FMatchFareClassWildcard+0x54

    Please let me know if you find what causes this.

  • 10-15-2007, 11:36 PM In reply to

    Re: LDAP IIS 6 Problem

    No idea Sorry.  I would use a network sniffer to see what is happening.  Make sure your code points to a single domain controller and see if the results speed up.  Also, make sure the queries you are running you test directly on a domain controller (test domain prefererably) or a stub program to isolate your queries are optimized.  Beyond that, I don't know what else to recommend.

    PS: Here is an LDAP browser I've used to determine the data I'm going after.  You'll need to check with your AD admin's first (or I would recommend it).

    http://www.ldapbrowser.com/download.htm

     

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 10-19-2007, 2:00 AM In reply to

    • shp1979
    • Not Ranked
    • Joined on 10-09-2007, 6:48 PM
    • Posts 5

    Re: LDAP IIS 6 Problem

    Hi..... do you guys see anything wrong with this code.. something that i am overlooking or missing... please let me know... i am still trying to find solution for my problem.

    i am trying to determine whether the user's password is going to expire..

    thanks,

    sushil 

     

      public LdapQueryResponse getPasswordExpirationProtocol(LdapQueryUserData userData)
            {
                LdapQueryResponse lqr = null;
                SearchResponse response = null;

                PopulateTrustedDomainList(false);

                // get user data
                // get full domain name
                string fullDNS = null;

                lock (lockObj)
                {
                    foreach (string domain in trustedDomains)
                    {
                        if (domain.ToUpper().StartsWith(userData.Domain.ToUpper()))
                        {
                            fullDNS = domain;
                            break;
                        }
                    }
                }

                // if full domain name cannot be resolved then return error
                if (fullDNS == null)
                {
                    throw new Exception("Could not resolve full domain name for domain name : " + userData.Domain);
                }      

                System.DirectoryServices.Protocols.LdapConnection connect = null;
                try
                {
                    if (connect == null)
                    {
                       connect = new System.DirectoryServices.Protocols.LdapConnection(new LdapDirectoryIdentifier(fullDNS));
                         connect.SessionOptions.ProtocolVersion = 3;
                        connect.SessionOptions.ReferralChasing = ReferralChasingOptions.None;
                        connect.SessionOptions.AutoReconnect = false;
                        connect.SessionOptions.PingKeepAliveTimeout = TimeSpan.FromSeconds(5);
                        connect.SessionOptions.PingLimit = 1;
                        connect.SessionOptions.PingWaitTimeout = TimeSpan.FromSeconds(5);
                        connect.SessionOptions.TcpKeepAlive = false;
                        connect.Timeout = TimeSpan.FromSeconds(10);
                        connect.Bind();
                    }   

                    //create path to search ldap server
                    string[] fullDNSSplit = fullDNS.Split(new char[] { '.' });

                    string dcPart = "";
                    for (int i = 0; i < fullDNSSplit.Length; i++)
                    {
                        dcPart += "DC=" + fullDNSSplit[i];
                        if (i < fullDNSSplit.Length - 1)
                        {
                            dcPart += ",";
                        }
                    }

                    long passwordAge = -1;
            

                    SearchRequest request = new SearchRequest(dcPart, "(objectClass=domainDNS)", System.DirectoryServices.Protocols.SearchScope.Subtree, new string[] { "maxpwdage" });
                    request.TimeLimit = TimeSpan.FromSeconds(10);
                    request.Scope = System.DirectoryServices.Protocols.SearchScope.Base;
                    request.SizeLimit = 500;              

                    response = (SearchResponse)connect.SendRequest(request, TimeSpan.FromSeconds(5));

                    if (response.Entries.Count > 0)
                    {
                        SearchResultEntry entry = response.Entries[0];
                        if (entry.Attributes.Contains("maxpwdage"))
                        {
                            string maxpwdage = entry.Attributes["maxpwdage"][0].ToString();
                            Int64 parameterValue = Int64.Parse(maxpwdage);
                            int hi = (int)(parameterValue >> 32);
                            int lo = (int)(parameterValue & 0xFFFFFFFF);
                            passwordAge = (long)((hi * Math.Pow(2, 32)) + lo);

                            if (passwordAge == -9223372036854775808)
                            {
                                passwordAge = 0;
                            }
                        }
                    }
                    else
                    {
                        throw new Exception("Didn't receive any information about global policies");
                    }

                    if (passwordAge == -1)
                    {
                        throw new Exception("Failed to read password age");
                    }

                    if (passwordAge == 0)
                    {
                        lqr = new LdapQueryResponse();
                        lqr.PasswordExpires = false;
                        lqr.log = logStr;
                        return lqr;
                    }

                    request = new SearchRequest(dcPart, "(SAMAccountName=" + userData.UserName + ")", System.DirectoryServices.Protocols.SearchScope.Subtree, new string[] { "userAccountControl", "pwdLastSet" });

                    response = (SearchResponse)connect.SendRequest(request, TimeSpan.FromSeconds(5));

                    bool passwordDoesNotExpire = false;
                    DateTime passwordLastSet = DateTime.MinValue;

                    if (response.Entries.Count > 0)
                    {
                        SearchResultEntry entry = response.Entries[0];

                        if (entry.Attributes.Contains("userAccountControl"))
                        {
                            int userAccountControl = Int32.Parse(entry.Attributes["userAccountControl"][0].ToString());
                            if (Convert.ToBoolean((int)(userAccountControl & 0x0020)))
                            {
                                passwordDoesNotExpire = true;
                            }
                            else
                                if (Convert.ToBoolean((int)(userAccountControl & 0x10000)))
                                {
                                    passwordDoesNotExpire = true;
                                }
                        }

                        if (entry.Attributes.Contains("pwdLastSet"))
                        {
                            Int64 parameterValue = Int64.Parse(entry.Attributes["pwdLastSet"][0].ToString());
                            int hi = (int)(parameterValue >> 32);
                            int lo = (int)(parameterValue & 0xFFFFFFFF);
                            long ticks = (long)((hi * Math.Pow(2, 32)) + lo);

                            if (ticks != 0)
                            {
                                passwordLastSet = DateTime.FromFileTime(ticks);
                            }
                            else
                            {
                                throw new Exception("User password not set yet");
                            }
                        }
                        else
                        {
                            throw new Exception("Failed to read password last set date. Parameter not available");
                        }
                    }
                    else
                    {
                        throw new Exception("Didn't receive any information about user's password change date");
                    }

                    if (passwordDoesNotExpire)
                    {
                        lqr = new LdapQueryResponse();
                        lqr.PasswordExpires = false;
                        lqr.log = logStr;
                        return lqr;
                    }

                    // if user's last password change date cannot be read then return error
                    if (passwordLastSet == DateTime.MinValue)
                    {
                        throw new Exception("Failed to get value for password last set date");
                    }

                    //     add the password age to the last password change date and get the
                    //    password expiry date                
                    DateTime passwordExpiryDate = passwordLastSet.Subtract(new TimeSpan(passwordAge));

                    lqr = new LdapQueryResponse();
                    lqr.PasswordExpires = true;
                    lqr.ExpiryDate = passwordExpiryDate;
                    lqr.log = logStr;
                }
                catch (Exception e)
                {
                    lqr = new LdapQueryResponse();
                    lqr.InternalError = true;
                    lqr.ErrorMessage = "Error in getPasswordExpirationProtocol: " + e.Message + " " + userData.UserName + " " + userData.Password + " " + userData.Domain;
                    lqr.log = logStr;   
                    return lqr;
                }
                finally
                {               
                    try
                    {
                        if (connect != null)
                        {
                            connect.Dispose();
                        }
                    }
                    catch (Exception e1)
                    {
                        lqr.InternalError = true;
                        lqr.ErrorMessage = lqr.ErrorMessage + "|" + e1.Message;
                    }

                    connect = null;

                }
                return lqr;            
            }

          

Page 1 of 1 (11 items)
Microsoft Communities