Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't accept user into PI group #109

Open
simonLeary42 opened this issue Oct 28, 2024 · 1 comment
Open

can't accept user into PI group #109

simonLeary42 opened this issue Oct 28, 2024 · 1 comment

Comments

@simonLeary42
Copy link
Contributor

accepting user into PI group causes timeout error / blank page

[Mon Oct 28 16:32:45.783277 2024] [php7:error] [pid 2262080] [client 128.111.197.218:53616] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /srv/www/unity-web-1.1.1/vendor/hakasapl/phpopenldaper/src/PHPOpenLDAPer/LDAPEntry.php on line 167
[Mon Oct 28 16:33:19.312955 2024] [php7:error] [pid 2261999] [client 128.111.197.218:36826] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /srv/www/unity-web-1.1.1/resources/lib/UnityLDAP.php on line 132
[Mon Oct 28 16:33:53.826068 2024] [php7:error] [pid 2261789] [client 128.111.197.218:36838] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /srv/www/unity-web-1.1.1/vendor/hakasapl/phpopenldaper/src/PHPOpenLDAPer/LDAPConn.php on line 89
[Mon Oct 28 16:35:37.465928 2024] [php7:error] [pid 2262080] [client 128.111.197.218:59246] PHP Fatal error:  Maximum execution time of 30 seconds exceeded in /srv/www/unity-web-1.1.1/vendor/hakasapl/phpopenldaper/src/PHPOpenLDAPer/LDAPConn.php on line 87

this is happening for pi_jlb_umass_edu for user broder49@msu.edu

@bryank-cs
Copy link
Contributor

The issue was GIDNumInUse was getting called for every user and not caching the result. Suggested fix:

diff --git a/resources/lib/UnityLDAP.php b/resources/lib/UnityLDAP.php
index b5a5d90..8bc2af8 100644
--- a/resources/lib/UnityLDAP.php
+++ b/resources/lib/UnityLDAP.php
@@ -192,7 +192,11 @@ class UnityLDAP extends ldapConn

     private function GIDNumInUse($id)
     {
-        $users = $this->groupOU->getChildrenArray(true);
+        static $users = null;
+        # Only do this lookup once
+        if ($users === null) {
+            $users =  $this->groupOU->getChildrenArray(true);
+        }
         foreach ($users as $user) {
             if ($user["gidnumber"][0] == $id) {
                 return true;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants