Bug 57155 - OX-Connector should create group, if it is missing in OX, should handle HTTP 4xx and 5xx
OX-Connector should create group, if it is missing in OX, should handle HTTP ...
Status: NEW
Product: Z_Internal OX development
Classification: Unclassified
Component: OX-Connector
UCS 5.0 / 7.10.6
Other Linux
: P5 normal (vote)
: ---
Assigned To: Mail maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2024-03-18 10:58 CET by Christina Scheinig
Modified: 2024-03-18 11:31 CET (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.114
Enterprise Customer affected?: Yes
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2024031121000425
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 Christina Scheinig univentionstaff 2024-03-18 10:58:12 CET

    
Comment 2 Daniel Tröder univentionstaff 2024-03-18 11:26:53 CET
Anonymized version
------------------


OX log:
------------------------------------------------------------------------
com.openexchange.admin.rmi.exceptions.NoSuchGroupException: com.openexchange.admin.rmi.exceptions.NoSuchObjectException: com.openexchange.admin.rmi.exceptions.NoSuchGroupException: No such group XXXXX in context 10; exceptionId 1104740454-574112; exceptionId 1104740454-574114; exceptionId 1104740454-574116
        at com.openexchange.admin.rmi.impl.OXGroup.getData(OXGroup.java:568)
        at com.openexchange.admin.soap.group.soap.OXGroupServicePortTypeImpl.getData(OXGroupServicePortTypeImpl.java:688)
...

Caused by: com.openexchange.admin.rmi.exceptions.NoSuchGroupException: No such group XXXXX in context 10; exceptionId 1104740454-574112
        at com.openexchange.admin.storage.mysqlStorage.OXToolMySQLStorage.getGroupIDByGroupname(OXToolMySQLStorage.java:1263)
        at com.openexchange.admin.rmi.impl.OXCommonImpl.setIdOrGetIDFromNameAndIdObject(OXCommonImpl.java:194)
        ... 45 common frames omitted
2024-03-15T14:37:19,270+0100 ERROR [OXWorker-0016475] com.openexchange.admin.rmi.impl.OXCommonImpl.logAndReturnException(OXCommonImpl.java:336)
------------------------------------------------------------------------

In ox-connector.log

------------------------------------------------------------------------
2024-03-11 15:41:12 INFO    modify of cn=XXXXX,cn=groups,dc=XXXXX (id: b'457c858e-718e-103e-8ead-59fca37558d2', file: /var/lib/univention-appcenter/listener//ox-connector/2024-03-11-15-41-12-263502.json)
2024-03-11 15:41:12 INFO    Using App account connection
2024-03-11 15:41:12 INFO    conversion of cn=XXXXX,cn=groups,dc=XXXXX (id: 457c858e-718e-103e-8ead-59fca37558d2, file: /var/lib/univention-appcenter/apps/ox-connector/data/listener/2024-03-11-15-41-12-263502.json)
2024-03-11 15:41:13 INFO    Looking for old data in /var/lib/univention-appcenter/apps/ox-connector/data/listener/old/457c858e-718e-103e-8ead-59fca37558d2.json
2024-03-11 15:41:13 INFO    Handling PosixPath('/var/lib/univention-appcenter/apps/ox-connector/data/listener/2024-03-11-15-41-12-263502.json')
2024-03-11 15:41:13 INFO    Group XXXXX will be OX Group
2024-03-11 15:41:13 INFO    Loading old object from /var/lib/univention-appcenter/apps/ox-connector/data/listener/old/419a17fc-0b21-1039-8c95-ab87ecac1587.json
2024-03-11 15:41:13 INFO    Loading old object from /var/lib/univention-appcenter/apps/ox-connector/data/listener/old/7c1236f0-a16e-1035-804e-4da45a850a93.json
.....
2024-03-11 15:41:13 INFO    Object('groups/group', 'cn=XXXXX,cn=groups,dc=XXXXX') will be processed with context 10
2024-03-11 15:41:13 INFO    Modifying Object('groups/group', 'cn=XXXXX,cn=groups,dc=XXXXX')
2024-03-11 15:41:14 INFO    Error while processing /var/lib/univention-appcenter/apps/ox-connector/data/listener/2024-03-11-15-41-12-263502.json
2024-03-11 15:41:14 WARNING Traceback (most recent call last):
2024-03-11 15:41:14 WARNING   File "/usr/lib/python3.9/site-packages/zeep/loader.py", line 50, in parse_xml
2024-03-11 15:41:14 WARNING     elementtree = fromstring(content, parser=parser, base_url=base_url)
.....
2024-03-11 15:41:14 WARNING   File "/usr/lib/python3.9/site-packages/univention/ox/provisioning/groups.py", line 129, in modify_group
2024-03-11 15:41:14 WARNING     group_id = get_group_id(obj)
2024-03-11 15:41:14 WARNING   File "/usr/lib/python3.9/site-packages/univention/ox/provisioning/groups.py", line 95, in get_group_id
2024-03-11 15:41:14 INFO    Successfully processed 0 files during this run
2024-03-11 15:41:14 WARNING     group = get_obj_by_name_from_ox(Group, context_id, groupname)
2024-03-11 15:41:14 WARNING   File "/usr/lib/python3.9/site-packages/univention/ox/provisioning/helpers.py", line 41, in get_obj_by_name_from_ox
2024-03-11 15:41:14 WARNING     return klass.from_ox(context_id, name=name)
2024-03-11 15:41:14 WARNING   File "/usr/lib/python3.9/site-packages/univention/ox/soap/backend.py", line 122, in from_ox
2024-03-11 15:41:14 WARNING     soap_obj = cls.service(context_id).get_data(cls.service(context_id).Type(id=obj_id, name=name))
2024-03-11 15:41:14 WARNING   File "/usr/lib/python3.9/site-packages/univention/ox/soap/services.py", line 633, in get_data
2024-03-11 15:41:14 WARNING     return self._call_ox('getData', grp=grp)
2024-03-11 15:41:14 WARNING   File "/usr/lib/python3.9/site-packages/univention/ox/soap/services.py", line 194, in _call_ox
2024-03-11 15:41:14 WARNING     return getattr(service, func)(**kwargs)
.....
2024-03-11 15:41:14 WARNING zeep.exceptions.TransportError: Server returned response (500) with invalid XML: Invalid XML content received (Space required after the Public Identifier, line 1, column 50).
------------------------------------------------------------------------

What was received was HTML instead of SOAP/XML.
Could only be found out by patching the ox-connector to log the whole response text:

------------------------------------------------------------------------
2024-03-11 15:41:14 WARNING Content: b'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>500 Internal Server Error</title>\n</head><body>\n<h1>Internal Server Error</h1>\n<p>The server encountered an internal error or\nmisconfiguration and was unable to complete\nyour request.</p>\n<p>Please contact the server administrator at \n webmaster@XXXXX to inform them of the time this error occurred,\n and the actions you performed just before this error.</p>\n<p>More information about this error may be available\nin the server error log.</p>\n<hr>\n<address>Apache Server at XXXXX Port 443</address>\n</body></html>\n'
------------------------------------------------------------------------


1. The ox-connector or the zeep library should handle HTTP status 4xx and 5xx, instead of trying to read the response:
1.1 Log the text in the response to make debugging easier.
1.2 Don't expect a SOAP response in such a case. Handle the situation or raise an error.

2. The ox-connector should try to fix the current situation in an HTTP 4xx/5xx situation.
2.1 There is no general rule on what to do. But find a way to add "handlers" for "most likely problem in this situation".
2.2 When modifying a group, and an error happens in OX; try to "handle" it: Use SOAP to look for the group. If it doesn't exist, create it. Then retry the modify-operation. If that didn't fix it, give up.