Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-18130

cas_ldap_sync_users.php does not properly close tcp connections

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.4
    • Fix Version/s: 1.9.6
    • Component/s: Authentication
    • Labels:
      None
    • Environment:
      Windows 2003 Virtual Server
      PHP 5.2.6
      apache 2.2.8
      Mysql 5.0.15b
      Moodle 1.9.4+
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      When running the cas_ldap_sync_users.php script I have found that tcp connections are being left open for an indefinite time. I currently have around 500000 tcp connections active and open on my webserver. See this thread for more information http://moodle.org/mod/forum/discuss.php?d=114685 This may also be an issue for the auth_ldap_synce_users.php script.

        Gliffy Diagrams

          Activity

          Hide
          iarenaza Iñaki Arenaza added a comment -

          This should be fixed in CVS for version 1.9 and HEAD.

          Saludos. Iñaki.

          Show
          iarenaza Iñaki Arenaza added a comment - This should be fixed in CVS for version 1.9 and HEAD. Saludos. Iñaki.
          Hide
          ashleyholman Ashley Holman added a comment -

          This recent CVS commit broke my LDAP sync so I had to revert the patch in my local repo. When updating users it would say "skipped" for all users. The problem seemed to be in the ldap_find_userdn function:

          update_user_record()
          --> get_userinfo()
          --> ldap_find_userdn(): was returning false every time

          I didn't do much debugging beyond that, but reverted the patch and it's working again now.

          BTW I have another patch that I've been using on a different installation which speeds up the LDAP sync dramatically (reduced the execution time from about 9 hours down to ~5mins). When doing the initial (cn=*) query, I modified the filter to request all the attributes that we need about the users, and then cache those results, which get_userinfo() then uses to return the info without having to do another search. As a result, only one LDAP search is actually performed rather than tens of thousands.

          I've attached the patch here if anyone is interested.

          Show
          ashleyholman Ashley Holman added a comment - This recent CVS commit broke my LDAP sync so I had to revert the patch in my local repo. When updating users it would say "skipped" for all users. The problem seemed to be in the ldap_find_userdn function: update_user_record() --> get_userinfo() --> ldap_find_userdn(): was returning false every time I didn't do much debugging beyond that, but reverted the patch and it's working again now. BTW I have another patch that I've been using on a different installation which speeds up the LDAP sync dramatically (reduced the execution time from about 9 hours down to ~5mins). When doing the initial (cn=*) query, I modified the filter to request all the attributes that we need about the users, and then cache those results, which get_userinfo() then uses to return the info without having to do another search. As a result, only one LDAP search is actually performed rather than tens of thousands. I've attached the patch here if anyone is interested.
          Hide
          iarenaza Iñaki Arenaza added a comment -

          Hi Ashley,

          what Moodle version are you using? 1.8? 1.9? What LDAP server?

          Saludos. Iñaki.

          Show
          iarenaza Iñaki Arenaza added a comment - Hi Ashley, what Moodle version are you using? 1.8? 1.9? What LDAP server? Saludos. Iñaki.
          Hide
          ashleyholman Ashley Holman added a comment -

          Hi Inaki,

          I was using Moodle 1.9 with ADLDS. Sorry for the delay in response - I missed this one, but it's been a long time since I had that problem and didn't realise this bug got marked as re-opened.

          I don't recall the exact problem anymore but I didn't have enough time to investigate so just worked around it, but don't want to hold this up from being resolved so I think you could close this off now.

          Thanks
          Ashley

          Show
          ashleyholman Ashley Holman added a comment - Hi Inaki, I was using Moodle 1.9 with ADLDS. Sorry for the delay in response - I missed this one, but it's been a long time since I had that problem and didn't realise this bug got marked as re-opened. I don't recall the exact problem anymore but I didn't have enough time to investigate so just worked around it, but don't want to hold this up from being resolved so I think you could close this off now. Thanks Ashley
          Hide
          ashleyholman Ashley Holman added a comment -

          PS. I am going to post my cache patch as a new issue.

          cheers

          Show
          ashleyholman Ashley Holman added a comment - PS. I am going to post my cache patch as a new issue. cheers
          Hide
          iarenaza Iñaki Arenaza added a comment -

          Ashley,

          thanks a lot for your feed back! Re-closing now.

          Saludos. Iñaki.

          Show
          iarenaza Iñaki Arenaza added a comment - Ashley, thanks a lot for your feed back! Re-closing now. Saludos. Iñaki.

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                21/Oct/09