Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-13102

Build hangs trying to send email if an email address isn't defined in Active Directory

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • email-ext-plugin
    • None
    • Jenkins - 1.455
      email-ext 2.18
      perforce plugin - 1.3.9
      AD plugin - 1.26
      Windows 2003 master
      Linux x64 slave

      I have some builds that hang when the perforce user is "build". In perforce build has a valid email. In Active Directory there is no email for the build user. I'm fixing this to get around the issue, so I may not be able to reproduce this for long(I'm not the IT guy). I don't know why perforce is trying to get the email from AD, so that may be a perforce plugin bug. Here is the stack trace from the jenkins.err log. The build hangs when trying to send email, you can try to cancel the job, but the job never goes away. Eventually the job does time out, but it can take over 8 hours(4 domains to search through)

      javax.naming.NamingException: [LDAP: error code 1 - 00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece ]; remaining name 'DC=company,DC=com'
      at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
      at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
      at com.sun.jndi.ldap.LdapCtx.searchAux(Unknown Source)
      at com.sun.jndi.ldap.LdapCtx.c_search(Unknown Source)
      at com.sun.jndi.ldap.LdapCtx.c_search(Unknown Source)
      at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(Unknown Source)
      at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source)
      at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source)
      at hudson.plugins.active_directory.LDAPSearchBuilder.search(LDAPSearchBuilder.java:52)
      at hudson.plugins.active_directory.LDAPSearchBuilder.searchOne(LDAPSearchBuilder.java:42)
      at hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.retrieveUser(ActiveDirectoryUnixAuthenticationProvider.java:191)
      at hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.retrieveUser(ActiveDirectoryUnixAuthenticationProvider.java:130)
      at hudson.plugins.active_directory.ActiveDirectoryUnixAuthenticationProvider.retrieveUser(ActiveDirectoryUnixAuthenticationProvider.java:95)
      at hudson.plugins.active_directory.AbstractActiveDirectoryAuthenticationProvider.loadUserByUsername(AbstractActiveDirectoryAuthenticationProvider.java:27)
      at hudson.plugins.active_directory.ActiveDirectoryMailAddressResolverImpl.findMailAddressFor(ActiveDirectoryMailAddressResolverImpl.java:31)
      at hudson.tasks.MailAddressResolver.resolve(MailAddressResolver.java:100)
      at hudson.tasks.Mailer$UserProperty.getAddress(Mailer.java:514)
      at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:335)
      at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:255)
      at hudson.plugins.emailext.ExtendedEmailPublisher._perform(ExtendedEmailPublisher.java:247)
      at hudson.plugins.emailext.ExtendedEmailPublisher.perform(ExtendedEmailPublisher.java:207)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:703)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:678)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:656)
      at hudson.model.Build$RunnerImpl.cleanUp(Build.java:171)
      at hudson.model.Run.run(Run.java:1454)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:238)

          [JENKINS-13102] Build hangs trying to send email if an email address isn't defined in Active Directory

          Alex Earl added a comment -

          The email-ext plugin uses the default mailer to resolve emails, so this issue would also exist in the default mailer.

          Alex Earl added a comment - The email-ext plugin uses the default mailer to resolve emails, so this issue would also exist in the default mailer.

          Code changed in jenkins
          User: Alex Earl
          Path:
          src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java
          http://jenkins-ci.org/commit/email-ext-plugin/f4f5cf9ebad1e14602cb5e70e17fdf7cb2ea6691
          Log:
          Fix JENKINS-13102

          Added a try/catch around address resolution for each user.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/hudson/plugins/emailext/ExtendedEmailPublisher.java http://jenkins-ci.org/commit/email-ext-plugin/f4f5cf9ebad1e14602cb5e70e17fdf7cb2ea6691 Log: Fix JENKINS-13102 Added a try/catch around address resolution for each user.

          Alex Earl added a comment -

          Sorry, the fix above won't stop the time issue, it will only continue if resolution for a specific address fails. I am still investigating how to work around the resolution issue.

          Alex Earl added a comment - Sorry, the fix above won't stop the time issue, it will only continue if resolution for a specific address fails. I am still investigating how to work around the resolution issue.

          Alex Earl added a comment -

          What if you add the build user to the Jenkins user list and give it a valid email address? This should resolve the issue.

          Alex Earl added a comment - What if you add the build user to the Jenkins user list and give it a valid email address? This should resolve the issue.

            Unassigned Unassigned
            aflat aflat
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: