Possible fix to #8563 - unset $ldapUsers to avoid OOM'ing #8594
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was also a typo which I fixed -
checkLdapConnetion
instead ofcheckLdapConnection
We deliberately unset
$ldapUsers
because it's going to be a chunk of 500 or so LDAP users, (and some paging information). We recursively callprocessLdapUsers()
over and over to page through the entire directory, but$ldapUsers
won't get Garbage-Collected until the entire recursive function series completes.So I temporarily store the current page from the result set, then I deliberately
unset()
the$ldapUsers
variable before the recursive call is made.I can't replicate the bug locally, unfortunately, so I can't be certain that this will help, but this seems like it at least won't hurt.