LDAP connection timeout

1,122 views
Skip to first unread message

Niranjan Rao

unread,
Jan 28, 2020, 8:06:59 PM1/28/20
to jenkins...@googlegroups.com
Greetings,

I'm seeing following exception in catalina.out. This is new installation
with Jenkins version 2.218 is deployed as WAR file on tomcat. Upon
startup LDAP authentication works perfectly fine but times out after
sometime and no one can login. Only solution so far is to restart tomcat.

I tried researching the problem and tries setting properties in
"setenv.sh" as per some of the pointers I found over the web.

-Dcom.sun.jndi.ldap.connect.pool=false
-Dcom.sun.jndi.ldap.connect.timeout=3000
-Dcom.sun.jndi.ldap.read.timeout=1000

Catalina.out file logs the values are being read, but it's not
reflecting "60000ms" and not sure where LDAP pluging/Jenkins is seeing
this value .

How do I fix this problem.


Caused by: org.acegisecurity.ldap.LdapDataAccessException:
LdapCallback;LDAP response read timed out, timeout used:60000ms.; nested
exception is javax.naming.NamingException: LDAP response read timed out\
, timeout used:60000ms.; remaining name ''
        at
org.acegisecurity.ldap.LdapTemplate$LdapExceptionTranslator.translate(LdapTemplate.java:295)
        at
org.acegisecurity.ldap.LdapTemplate.execute(LdapTemplate.java:128)
        at
org.acegisecurity.ldap.LdapTemplate.searchForSingleEntry(LdapTemplate.java:246)
        at
org.acegisecurity.ldap.search.FilterBasedLdapUserSearch.searchForUser(FilterBasedLdapUserSearch.java:119)
        at
org.acegisecurity.providers.ldap.authenticator.BindAuthenticator.authenticate(BindAuthenticator.java:71)
        at
org.acegisecurity.providers.ldap.authenticator.BindAuthenticator2.authenticate(BindAuthenticator2.java:49)
        at
org.acegisecurity.providers.ldap.LdapAuthenticationProvider.retrieveUser(LdapAuthenticationProvider.java:233)
        ... 42 more
Caused by: javax.naming.NamingException: LDAP response read timed out,
timeout used:60000ms.; remaining name ''
        at com.sun.jndi.ldap.Connection.readReply(Connection.java:490)
        at com.sun.jndi.ldap.LdapClient.getSearchReply(LdapClient.java:638)
        at com.sun.jndi.ldap.LdapClient.search(LdapClient.java:561)
        at com.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1985)
        at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1844)
        at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1769)
        at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1786)
        at
com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:418)
        at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:396)
        at
com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:378)
        at
javax.naming.directory.InitialDirContext.search(InitialDirContext.java:286)
        at
org.acegisecurity.ldap.LdapTemplate$3.doInDirContext(LdapTemplate.java:249)
        at
org.acegisecurity.ldap.LdapTemplate.execute(LdapTemplate.java:126)
        ... 47 more


Regards,


Niranjan

Sverre Moe

unread,
Apr 24, 2020, 10:03:32 AM4/24/20
to Jenkins Users
We have been having the same problem for years.

Login through LDAP is slow. I need to try 3 times before it actually authenticates.

Apr 24, 2020 3:19:54 PM WARNING hudson.security.LDAPSecurityRealm$LDAPAuthenticationManager authenticate
Failed communication with ldap server.
javax
.naming.NamingException: LDAP response read timed out, timeout used:60000ms.; remaining name 'ou=users'
        at com
.sun.jndi.ldap.Connection.readReply(Connection.java:507)
        at com
.sun.jndi.ldap.LdapClient.getSearchReply(LdapClient.java:632)
        at com
.sun.jndi.ldap.LdapClient.search(LdapClient.java:555)

        at com
.sun.jndi.ldap.LdapCtx.doSearch(LdapCtx.java:1985)
        at com
.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1844)
        at com
.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1769)
        at com
.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1786)
        at com
.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:418)
        at com
.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:396)
        at com
.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:378)
        at javax
.naming.directory.InitialDirContext.search(InitialDirContext.java:286)
        at org
.acegisecurity.ldap.LdapTemplate$3.doInDirContext(LdapTemplate.java:249)
        at org
.acegisecurity.ldap.LdapTemplate.execute(LdapTemplate.java:126)
Caused: org.acegisecurity.ldap.LdapDataAccessException: LdapCallback;LDAP response read timed out, timeout used:60000ms.; nested exception is javax.naming.NamingException: LDAP response read timed out, timeout used:60000ms.; remaining name 'ou=users'

        at org
.acegisecurity.ldap.LdapTemplate$LdapExceptionTranslator.translate(LdapTemplate.java:295)
        at org
.acegisecurity.ldap.LdapTemplate.execute(LdapTemplate.java:128)
        at org
.acegisecurity.ldap.LdapTemplate.searchForSingleEntry(LdapTemplate.java:246)
        at org
.acegisecurity.ldap.search.FilterBasedLdapUserSearch.searchForUser(FilterBasedLdapUserSearch.java:119)
        at org
.acegisecurity.providers.ldap.authenticator.BindAuthenticator.authenticate(BindAuthenticator.java:71)
        at org
.acegisecurity.providers.ldap.authenticator.BindAuthenticator2.authenticate(BindAuthenticator2.java:49)
        at org
.acegisecurity.providers.ldap.LdapAuthenticationProvider.retrieveUser(LdapAuthenticationProvider.java:233)
Caused: org.acegisecurity.AuthenticationServiceException: LdapCallback;LDAP response read timed out, timeout used:60000ms.; nested exception is javax.naming.NamingException: LDAP response read timed out, timeout used:60000ms.; remaining name 'ou=users'; nested exception is org.acegisecurity.ldap.LdapDataAccessException: LdapCallback;LDAP response read timed out, timeout used:60000ms.; nested exception is javax.naming.NamingException: LDAP response read timed out, timeout used:60000ms.; remaining name 'ou=users'
        at org
.acegisecurity.providers.ldap.LdapAuthenticationProvider.retrieveUser(LdapAuthenticationProvider.java:238)
        at org
.acegisecurity.providers.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:122)
        at org
.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:200)
        at org
.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:47)
        at hudson
.security.LDAPSecurityRealm$LDAPAuthenticationManager.authenticate(LDAPSecurityRealm.java:1019)
        at jenkins
.security.BasicHeaderRealPasswordAuthenticator.authenticate(BasicHeaderRealPasswordAuthenticator.java:56)
        at jenkins
.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:79)
        at hudson
.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        at org
.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
        at hudson
.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
        at hudson
.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
        at hudson
.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
        at hudson
.security.HudsonFilter.doFilter(HudsonFilter.java:171)
        at org
.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
        at org
.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
        at org
.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
        at hudson
.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
        at org
.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
        at org
.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
        at org
.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
        at org
.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
        at org
.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
        at org
.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
        at org
.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org
.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
        at org
.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1700)
        at org
.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
        at org
.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
        at org
.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
        at org
.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
        at org
.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1667)
        at org
.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
        at org
.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
        at org
.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
        at org
.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org
.eclipse.jetty.server.Server.handle(Server.java:505)
        at org
.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:370)
        at org
.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:267)
        at org
.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
        at org
.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
        at org
.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:427)
        at org
.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:321)
        at org
.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:159)
        at org
.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
        at org
.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
        at org
.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
        at org
.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
        at org
.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
        at org
.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
        at org
.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
        at org
.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:698)
        at org
.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:804)
        at java
.lang.Thread.run(Thread.java:748)


Our configuration:
Jenkins->Manage Jenkins->Configure Global Security
    LDAP
        Server: ldap://ldap.company.com:389
        root DN: dc=ad,dc=company,dc=com
        User search base: ou=users
        User search filter: sAMAccountName={0}
        Group membership: Parse user attribute for list of groups => memberOf
        Manager DN: mailuser@ad.company.com
        Manager password: *******
        Display Name LDAP Attribute: displayName
        Email Address LDAP Attribute: mail

Ben Ptacek

unread,
Apr 24, 2020, 6:52:22 PM4/24/20
to jenkins...@googlegroups.com
I feel your pain and had the same problem. 


 If the error persists, you may need to change the Group membership filter from the default of (| (member={0}) (uniqueMember={0}) (memberUid={1})) to a query only of the field used in your LDAP for group membership, such as: (member={0}).”

This is blank by default which will search all. Change this to the one you need and watch it speed up ten fold. 

Ben

On Apr 24, 2020, at 9:03 AM, Sverre Moe <sverr...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/786b6e78-20e0-4c52-ae50-ddc63ce9e31c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages