Bug 55746 - [UDM REST API] TypeError: super(type, obj): obj must be an instance or subtype of type
[UDM REST API] TypeError: super(type, obj): obj must be an instance or subtyp...
Status: NEW
Product: UCS
Classification: Unclassified
Component: UDM - REST API
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UMC maintainers
UMC maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2023-02-22 15:40 CET by Daniel Tröder
Modified: 2023-09-18 11:43 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.257
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Cleanup, Debt Technical, Large environments
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2023-02-22 15:40:01 CET
I have not have the time to create a simple reproducer. Here is what I have from log files:

Following the trail of request bcf76a0bd2 in the Kelvin log:

-----------------------------------------------------------------------------
2023-02-22 14:44:02 INFO  [423][bcf76a0bd2] user.create:845  Going to create ImportStaff(name='testkm21v7kwgo', school='testou2263', dn='uid=testkm21v7kwgo,cn=mitarbeiter,cn=users,ou=testou2263,dc=school,dc=test') with {'$dn$': 'uid=testkm21v7kwgo,cn=mitarbeiter,cn=users,ou=testou2263,dc=school,dc=test', 'objectType': 'users/user', 'school': 'testou2263', 'ucsschool_roles': ['staff:school:testou2263', 'staff:school:testou6529'], 'name': 'testkm21v7kwgo', 'schools': ['testou6529', 'testou2263'], 'firstname': 'z32992gfzh', 'lastname': 'knm54ig6kh', 'birthday': '1944-07-22', 'expiration_date': None, 'email': 'sx9rnyblzn@demoschool.example.com', 'password': '********', 'disabled': False, 'workgroups': {}, 'school_classes': {}, 'source_uid': 'TESTID', 'record_uid': 'wxgjgxgj5b', 'display_name': 'z32992gfzh knm54ig6kh', 'type_name': 'Staff', 'type': 'importStaff', 'action': 'A', 'entry_count': 0, 'udm_properties': {'phone': ['ez1j52c5lc', 'mj5tcpto9h'], 'organisation': 'i48lelr70f'}, 'input_data': [], 'old_user': None, 'in_hook': False, 'roles': ['staff']}...

[..]

2023-02-22 14:44:04 ERROR [423][bcf76a0bd2] main.udm_exception_handler:136  Encountered exception [HTTP 500]: for operation 'create' on 'users/user' with arguments {'users_user': {'options': {'pki': False, 'ucsschoolStudent': False, 'ucsschoolTeacher': False, 'ucsschoolStaff': True, 'ucsschoolAdministrator': False, 'ucsschoolExam': False}, 'policies': {'policies/umc': [], 'policies/pwhistory': [], 'policies/desktop': []}, 'position': 'cn=mitarbeiter,cn=users,ou=testou2263,dc=school,dc=test', 'properties': {'username': 'testkm21v7kwgo', 'firstname': 'z32992gfzh', 'lastname': 'knm54ig6kh', 'organisation': 'i48lelr70f', 'password': 'dbfqvcqm2vn4kbgfqvvk0vn61rt28rr4dewnmbw1jaxd5uyfqiq8y5ymjze1koum', 'e-mail': ['sx9rnyblzn@demoschool.example.com'], 'phone': ['ez1j52c5lc', 'mj5tcpto9h'], 'departmentNumber': ['testou2263'], 'birthday': '1944-07-22', 'unixhome': '/home/testou2263/mitarbeiter/testkm21v7kwgo', 'groups': ['cn=Domain Users testou6529,cn=groups,ou=testou6529,dc=school,dc=test', 'cn=Domain Users testou2263,cn=groups,ou=testou2263,dc=school,dc=test', 'cn=mitarbeiter-testou6529,cn=groups,ou=testou6529,dc=school,dc=test', 'cn=mitarbeiter-testou2263,cn=groups,ou=testou2263,dc=school,dc=test'], 'primaryGroup': 'cn=Domain Users testou2263,cn=groups,ou=testou2263,dc=school,dc=test', 'mailPrimaryAddress': 'sx9rnyblzn@demoschool.example.com', 'overridePWHistory': True, 'overridePWLength': True, 'school': ['testou6529', 'testou2263'], 'ucsschoolSourceUID': 'TESTID', 'ucsschoolRecordUID': 'wxgjgxgj5b', 'ucsschoolRole': ['staff:school:testou2263', 'staff:school:testou6529']}}}: Internal Server Error responding with [{'loc': (), 'msg': 'Internal Server Error', 'type': 'UdmError:APICommunicationError'}]
-----------------------------------------------------------------------------

And in the UDM REST API log:

-----------------------------------------------------------------------------
22.02.23 14:44:04       ERROR      (     6804) : Uncaught exception bcf76a0bd2: POST /udm/users/user/ (0.0.0.0)
    HTTPServerRequest(protocol='http', host='primary.school.test', method='POST', uri='/udm/users/user/', version='HTTP/1.1', remote_ip='0.0.0.0')
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/tornado/web.py", line 1592, in _execute
        result = yield result
      File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1133, in run
        value = future.result()
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 240, in decorator
        return await method(self, *self.path_args, **self.path_kwargs, **self.request.decoded_query_arguments, **self.request.body_arguments)
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 2962, in post
        obj = await obj.create(object_type, None, representation, result, serverctrls=serverctrls, response=response)
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 3369, in create
        dn = await self.pool_submit(self.handle_udm_errors, obj.create, **kwargs)
      File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1141, in run
        yielded = self.gen.throw(*exc_info)
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 405, in pool_submit
        return (yield future)
      File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1133, in run
        value = future.result()
      File "/usr/lib/python3.7/concurrent/futures/_base.py", line 425, in result
        return self.__get_result()
      File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
        raise self._exception
      File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 3383, in handle_udm_errors
        return action(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 557, in create
        dn = self._create(response=response, serverctrls=serverctrls)
      File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 1268, in _create
        al.extend(self._ldap_modlist())
      File "/usr/lib/python3/dist-packages/univention/admin/handlers/users/user.py", line 1564, in _ldap_modlist
        ml = self._modlist_password_expiry(ml, pwhistoryPolicy)
      File "/usr/lib/python3/dist-packages/univention/admin/handlers/users/user.py", line 1684, in _modlist_password_expiry
        pwd_change_next_login = self.hasChanged('pwdChangeNextLogin') and self['pwdChangeNextLogin'] == '1'
      File "/usr/lib/python3/dist-packages/univention/admin/handlers/users/user.py", line 1306, in hasChanged
        return super(object, self).hasChanged(key)
    TypeError: super(type, obj): obj must be an instance or subtype of type
22.02.23 14:44:04        INFO      (     6772) : 200 GET /udm/groups/group/?filter=name%3Daoed&position=dc%3Dschool,dc%3Dtest&scope=sub&hidden=true (127.0
.0.1) 214.72ms
22.02.23 14:44:04       ERROR      (     6804) : 500 bcf76a0bd2: POST /udm/users/user/ (0.0.0.0) 753.49ms
22.02.23 14:44:04       ERROR      (     6804) : Uncaught exception f390f56ddc: POST /udm/users/user/ (0.0.0.0)
    HTTPServerRequest(protocol='http', host='primary.school.test', method='POST', uri='/udm/users/user/', version='HTTP/1.1', remote_ip='0.0.0.0')
    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/tornado/web.py", line 1592, in _execute
        result = yield result
      File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1133, in run
        value = future.result()
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 240, in decorator
        return await method(self, *self.path_args, **self.path_kwargs, **self.request.decoded_query_arguments, **self.request.body_arguments)
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 2962, in post
        obj = await obj.create(object_type, None, representation, result, serverctrls=serverctrls, response=response)
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 3369, in create
        dn = await self.pool_submit(self.handle_udm_errors, obj.create, **kwargs)
      File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1141, in run
        yielded = self.gen.throw(*exc_info)
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 405, in pool_submit
        return (yield future)
      File "/usr/lib/python3/dist-packages/tornado/gen.py", line 1133, in run
        value = future.result()
      File "/usr/lib/python3.7/concurrent/futures/_base.py", line 425, in result
        return self.__get_result()
      File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
        raise self._exception
      File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/usr/lib/python3/dist-packages/univention/admin/rest/module.py", line 3383, in handle_udm_errors
        return action(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 557, in create
        dn = self._create(response=response, serverctrls=serverctrls)
      File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 1267, in _create
        al = self._ldap_addlist()
      File "/usr/lib/python3/dist-packages/univention/admin/handlers/users/user.py", line 1512, in _ldap_addlist
        al = super(object, self)._ldap_addlist()
    TypeError: super(type, obj): obj must be an instance or subtype of type
22.02.23 14:44:04       ERROR      (     6772) : 500 POST /udm/users/user/ (127.0.0.1) 771.96ms
-----------------------------------------------------------------------------
Comment 1 Florian Best univentionstaff 2023-02-22 15:43:13 CET
Probably python files were reloaded `univention.admin.modules.init(users_user, force_reload=True)` but old references still exists.

Were there multiple parallel requests (executed in threads)?
Comment 2 Daniel Tröder univentionstaff 2023-02-22 16:19:50 CET
(In reply to Florian Best from comment #1)
> Were there multiple parallel requests (executed in threads)?
Yes - creation of 20 users with groups in parallel.