Bug 55726 - UCRV umc/http/processes is set and apache.service dont start since update to UCS 5.0-3
UCRV umc/http/processes is set and apache.service dont start since update to ...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Apache
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-3-errata
Assigned To: Florian Best
Erik Damrose
https://git.knut.univention.de/univen...
:
Depends on: 55554
Blocks: 55753
  Show dependency treegraph
 
Reported: 2023-02-20 12:31 CET by Mirac Erdemiroglu
Modified: 2023-02-23 19:36 CET (History)
4 users (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?: 4: A User would return the product
User Pain: 0.343
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support: Yes
Flags outvoted (downgraded) after PO Review:
Ticket number: 2023021821000238
Bug group (optional): bitesize, Regression
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mirac Erdemiroglu univentionstaff 2023-02-20 12:31:52 CET
UCS Version 5.0-3

if the UCR variable umc/http/processes is set, after upgrading to UCS 5.0-3, Apache no longer works because "ucr commit" cannot generate the file
/etc/apache2/sites-available/univention.conf file correctly. This is not noticeable at first during the upgrade, there is no error due to univention-upgrade!

Apache said:

root@test:~# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2023-02-18 13:08:21 CET; 9s ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 14095 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Feb 18 13:08:21 test systemd[1]: Starting The Apache HTTP Server...
Feb 18 13:08:21 test apachectl[14095]: apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Syntax error on line 44 of /etc/apache2/sites-enabled/univention.conf:
/etc/apache2/sites-enabled/univention.conf:44: <Proxy> was not closed.
Feb 18 13:08:21 test apachectl[14095]: Action 'start' failed.

The error at ucr commit (also occurs frequently in updater.log):

root@test:~# ucr commit /etc/apache2/sites-available/univention.conf
File: /etc/apache2/sites-available/univention.conf
Traceback (most recent call last):
  File "<stdin>", line 14, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Comment 2 Erik Damrose univentionstaff 2023-02-20 13:14:17 CET
To which value are the UCR variables umc/http/* set to?
Comment 3 Erik Damrose univentionstaff 2023-02-20 13:41:14 CET
Proposal for a fix

--- management/univention-management-console/conffiles/etc/apache2/sites-available/univention.conf
+++ management/univention-management-console/conffiles/etc/apache2/sites-available/univention.conf
@@ -89,7 +89,7 @@ print('\tHeader always setifempty "Content-Security-Policy" "%s"' % (csp,))
 
 @!@
 if int(configRegistry.get('umc/http/processes', 1)) > 1:
-    start_port = configRegistry.get('umc/http/processes/start-port', 18200)
+    start_port = int(configRegistry.get('umc/http/processes/start-port', 18200))
     interface = configRegistry.get('umc/http/interface', '127.0.0.1')
     print('Header add Set-Cookie "UMCWEB_ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED')
     print('<Proxy "balancer://umcwebcluster">')
Comment 4 Florian Best univentionstaff 2023-02-20 13:59:16 CET
(In reply to Erik Damrose from comment #2)
> To which value are the UCR variables umc/http/* set to?
this doesn't matter as the traceback is about the second @!@ hunk.


it is kind of broken since beginning in git:336b258c5a38654ea85510079eda76570ad05a0f:
> 92     start_port = int(configRegistry.get('umc/http/processes/start-port', 18200))> 97         print('\tBalancerMember "http://%s:%d" route=%s retry=0 timeout=%d' % (interface, i + start_port, i + 1, int(configRegistry.get('umc/http/response-timeout', '310    ')) + 1))

→ no cast to int is done.

Since git:27e041f043fe956fde72c6e992062177e9d4acfd the default value is added in the UCR definition which causes this.
Comment 5 Mirac Erdemiroglu univentionstaff 2023-02-20 14:14:25 CET
I asked the customer and this value was set like in our doc
16 CPU cores: umc/http/processes=15 and umc/server/processes=15

https://docs.software-univention.de/ext-performance/5.0/en/#vertical-performance-scaling
Comment 6 Florian Best univentionstaff 2023-02-20 14:22:14 CET
The UCR template has been fixed:

univention-management-console.yaml
6c4f55bd83ee | fix(umc): fix UCR template when (default) value is set

univention-management-console (12.0.17-4)
6c4f55bd83ee | fix(umc): fix UCR template when (default) value is set
Comment 7 Philipp Hahn univentionstaff 2023-02-21 06:09:51 CET
[Bug#20933](https://forge.univention.org/bugzilla/show_bug.cgi?id=20933) added the `get_int()` API to UCS 5.0-0:
```diff
-    start_port = int(configRegistry.get('umc/http/processes/start-port', 18200))
+    start_port = configRegistry.get_int('umc/http/processes/start-port', 18200)
```
Comment 8 Erik Damrose univentionstaff 2023-02-21 12:52:44 CET
OK: Patch applied, fixes the issue.
OK~ I think we do not need the change the code further, as suggested
OK: univention-management-console 12.0.17-4A~5.0.0.202302201440
OK: yaml
Verified