Bug 57113 - UMC-Server: LDAP connection leak
UMC-Server: LDAP connection leak
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-7-errata
Assigned To: Florian Best
Marius Meschter
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2024-03-05 18:24 CET by Florian Best
Modified: 2024-03-20 17:18 CET (History)
0 users

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2024-03-05 18:24:52 CET
One leaking LDAP connection which is opened for the logged in user is created and not closed as LDAP connections are cached.
But the cache indicator is broken and is bound to the request instead of the session.
Therefore every new request opens a new LDAP connection.

Reproducer:
```python
import objgraph
import univention.management.console.message

x = univention.management.console.message.Request('foo')
y = univention.management.console.message.Request('foo')
x.user_dn = y.user_dn = 'uid=Administrator,cn=users,dc=school,dc=dev'
x.password = y.password = 'univention'

lo = x.get_user_ldap_connection()
print(objgraph.count('univention.admin.uldap.access'))  # prints 1

lo2 = x.get_user_ldap_connection()
lo2 = y.get_user_ldap_connection()
print(objgraph.count('univention.admin.uldap.access'))  # prints 2 (or 3), should print 1
```
Comment 1 Florian Best univentionstaff 2024-03-14 23:47:49 CET
UCS 5.2:
univention-management-console (14.0.6)
6454211c3107 | fix(umc): fix LDAP connection and memory leak

UCS 5.1:
univention-management-console (13.0.11)
6b9237f7182b | fix(umc): fix LDAP connection and memory leak

UCS 5.0-7:
univention-management-console.yaml
4cfe84207023 | fix(umc): fix LDAP connection and memory leak

univention-management-console (12.0.33-1)
4cfe84207023 | fix(umc): fix LDAP connection and memory leak
Comment 2 Marius Meschter univentionstaff 2024-03-19 17:34:00 CET
OK: changelog and YAML
OK: jenkins tests
OK: UMC functionality
OK: reproducer now correctly prints 1
OK: using the UMC memory analyzer functionality, verify that there are no increasing objects of type univention.admin.uldap.access
OK: setting umc/http/processes=0 spawns $(nproc) umc processes
OK: the circular reference has been removed