Bug 36532 - Changing network settings is slow
Changing network settings is slow
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Network
UCS 4.0
Other Linux
: P5 normal (vote)
: UCS 4.0-2-errata
Assigned To: Philipp Hahn
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-11-10 11:26 CET by Alexander Kläser
Modified: 2017-12-12 13:09 CET (History)
5 users (show)

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): UCS Performance, Usability
Max CVSS v3 score:
hahn: Patch_Available+


Attachments
Evaluate "BSD process accounting" (pacct) files (3.42 KB, text/plain)
2015-01-23 09:16 CET, Philipp Hahn
Details
Speedup network restart (146.43 KB, patch)
2015-01-23 09:17 CET, Philipp Hahn
Details | Diff
Screenshot (18.11 KB, image/png)
2015-07-02 18:41 CEST, Florian Best
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kläser univentionstaff 2014-11-10 11:26:22 CET
If I change network settings via UCR, services are restarted many times which currently leads to a fairly long waiting time (1min 20sec in the example log from setup.log below):

-------------------- 8< --------------------
=== 30_net/12gateway (2014-11-06 15:53:06) ===
__NAME__:30_net/12gateway Setting IPv4 gateway
Stopping NTP server: ntpd.
Restarting Name Service Cache Daemon: nscd.
Restarting bind9 daemon: .
done.
Restarting Name Service Cache Daemon: nscd.
Restarting bind9 daemon: .
done.
Restarting univention-directory-listener daemon.
ok: run: univention-directory-listener: (pid 26601) 0s, normally down
done.
Restarting univention-directory-notifier daemon: .
ok: run: univention-directory-notifier: (pid 26620) 0s, normally down
done.
Stopping univention-s4-connector daemon.
done.
Starting univention-s4-connector daemon.
done.
Restarting Name Service Cache Daemon: nscd.
Restarting bind9 daemon: .
done.
Restarting univention-directory-listener daemon.
ok: run: univention-directory-listener: (pid 26813) 1s, normally down
done.
Restarting univention-directory-notifier daemon: .
ok: run: univention-directory-notifier: (pid 26829) 0s, normally down
done.
Stopping univention-s4-connector daemon.
done.
Starting univention-s4-connector daemon.
done.
Restarting univention-directory-listener daemon.
ok: run: univention-directory-listener: (pid 26927) 0s, normally down
done.
Restarting univention-directory-notifier daemon: .
ok: run: univention-directory-notifier: (pid 26946) 0s, normally down
done.
Stopping univention-s4-connector daemon.
done.
Starting univention-s4-connector daemon.
done.
File: /etc/dhcp/dhclient.conf
Restarting bind9 daemon: .
done.
File: /etc/dhcp/dhclient.conf
Starting NTP server: ntpd.
Restarting Name Service Cache Daemon: nscd.
Restarting bind9 daemon: .
done.
Restarting Name Service Cache Daemon: nscd.
Setting gateway
Multifile: /etc/network/interfaces
=== 30_net/13ipv6gateway (2014-11-06 15:54:26) ===
-------------------- 8< --------------------

At the moment, the UCR network values are also set in the appliance wizard in the network page which may lead to a waiting time of 4-10sec (Bug 36110, comment 9).

It would be great if we could speed this up!
Comment 1 Alexander Kläser univentionstaff 2014-11-27 13:17:12 CET
(In reply to Alexander Kläser from comment #0)
> [...]
> At the moment, the UCR network values are also set in the appliance wizard
> in the network page which may lead to a waiting time of 4-10sec (Bug 36110,
> comment 9).

With up-to-date appliance images, it actually takes much longer (maybe 30-40sec).
Comment 2 Alexander Kläser univentionstaff 2014-12-01 11:55:57 CET
It would also be great to query the (at least rough) progress state in order to display this information to the user via UMC.
Comment 3 Philipp Hahn univentionstaff 2014-12-11 08:50:31 CET
r56682 | Bug #36532 Net: Fix ifupdown -a handling
Comment 4 Florian Best univentionstaff 2015-01-13 08:48:02 CET
Also: when going 'back' to the network page and clicking on 'next' without doing any change the network settings are applied again. This should not be done.
Comment 5 Philipp Hahn univentionstaff 2015-01-22 13:24:48 CET
1. univention-directory-notifier, univention-directory-listener, univention-bind9 are restarted multiple times. As this currently is synchronous, changing "eth0" into a simple bridge "br0" takes 25s.
This can be converted to an asynchronous behavior.

2. ntpd should not be restarted, as it already monitors new and deleted interfaces every 5 minutes: ma 8 ntpd → -U.
The scrips should be removed.

3. Several script do things for "--all" and "lo".
They should use ucs_ignore_interface().

Now I'm down to 5s.


(In reply to Florian Best from comment #4)
> Also: when going 'back' to the network page and clicking on 'next' without
> doing any change the network settings are applied again. This should not be
> done.

I get "No changes have been made.".
As this is a UMC bug, file an new bug against UMC USS.n
Comment 6 Philipp Hahn univentionstaff 2015-01-22 14:37:56 CET
r56682 has been reverted for now until the patch is applied.
Comment 7 Philipp Hahn univentionstaff 2015-01-23 09:16:22 CET
Created attachment 6625 [details]
Evaluate "BSD process accounting" (pacct) files

ucr set repositroy/online/unmaintained=yes
univention-install acct
...
python 36532_net-pacct.py /var/log/account/pacct
Comment 8 Philipp Hahn univentionstaff 2015-01-23 09:17:44 CET
Created attachment 6626 [details]
Speedup network restart

Subject: [PATCH 1/8] =?UTF-8?q?Bug=20#36532=20bind,s4c,listener,notifier,n?=
Subject: [PATCH 2/8] Bug #36532 bind: Speed up network re-config
Subject: [PATCH 3/8] Bug #36532 s4c,listener,notifier,net: Skip interfaces
Subject: [PATCH 4/8] Bug #36532 net: Skip ntpd restart
Subject: [PATCH 5/8] Bug #36532 net: Speed up UCR re-config
Subject: [PATCH 6/8] Bug #36532 net: Speed up DNS config
Subject: [PATCH 7/8] Bug #36532: Speed up if-*.d scripts
Subject: [PATCH 8/8] Bug #36532: Restart listener/notifier asynchronously

8 and 2 are the most important ones and bring the most.
Comment 9 Alexander Kläser univentionstaff 2015-01-23 10:47:59 CET
(In reply to Philipp Hahn from comment #8)
> Created attachment 6626 [details]
> Speedup network restart

Cool! Philipp, would it be possible to remove unnecessary changes in the supplied patch? The adjusted copyright year in many files just obfuscates important changes.
Comment 10 Philipp Hahn univentionstaff 2015-01-26 08:28:39 CET
(In reply to Alexander Kläser from comment #9)
> (In reply to Philipp Hahn from comment #8)
> > Created attachment 6626 [details]
> > Speedup network restart
> 
> Cool!

I know if at least two other persons which would like this issue being resolved. Perhaps you should vote for this bug to make that liking explicit.

> Philipp, would it be possible to remove unnecessary changes in the
> supplied patch? The adjusted copyright year in many files just obfuscates
> important changes.

Please read comment #9 carefully: the first patch (1/8) of the series updates all the copyright in all the modules the following 7 patches modify, so that the following 7 patches are NOT polluted by those changes. This was explicitly requested by Stefan.

FYI: The bug is now postponed as I spent too much time on that issue. The analysis is done, the patch is ready, but there currently is no ETA when it will be applied (again).
Comment 11 Florian Best univentionstaff 2015-01-28 10:06:51 CET
Is the change reverted? There still exists 2015-01-12-univention-network-manager.yaml
Comment 12 Philipp Hahn univentionstaff 2015-01-28 10:23:28 CET
(In reply to Florian Best from comment #11)
> Is the change reverted? There still exists
> 2015-01-12-univention-network-manager.yaml

Thanks:
r57627 | Revert "Bug #36532 net: WIP speed up network config YAML"
Comment 13 Philipp Hahn univentionstaff 2015-06-12 18:27:16 CEST
r61226 | Bug #36532 test: Add bind9 reload test
 ucs-test for test "rndc reload" works.

r61234 | Bug #36532: Restart listener/notifier asynchronously
r61233 | Bug #36532: Speed up if-*.d scripts
r61232 | Bug #36532 net: Speed up DNS config
r61231 | Bug #36532 net: Speed up UCR re-config
r61230 | Bug #36532 net: Skip ntpd restart
r61229 | Bug #36532 s4c,listener,notifier,net: Skip interfaces
r61228 | Bug #36532 bind: Speed up network re-config
r61227 | Bug #36532 bind,s4c,listener,notifier,net: © 2015

Package: ucs-test
Version: 5.0.148-12.1058.201506121718
Branch: ucs_4.0-0
Scope: errata4.0-2

Package: univention-network-manager
Version: 6.0.1-1.107.201506121759
Branch: ucs_4.0-0
Scope: errata4.0-2

Package: univention-directory-notifier
Version: 9.0.4-1.89.201506121802
Branch: ucs_4.0-0
Scope: errata4.0-2

Package: univention-bind
Version: 9.0.6-1.207.201506121804
Branch: ucs_4.0-0
Scope: errata4.0-2

Package: univention-s4-connector
Version: 9.0.17-1.558.201506121806
Branch: ucs_4.0-0
Scope: errata4.0-2

Package: univention-directory-listener
Version: 9.0.3-1.268.201506121809
Branch: ucs_4.0-0
Scope: errata4.0-2

r61235 | Bug #36532 net: Faster network restart YAML
 2015-06-03-univention-s4-connector.yaml
 2015-06-12-univention-bind.yaml
 2015-06-12-univention-directory-listener.yaml
 2015-06-12-univention-directory-notifier.yaml
 2015-06-12-univention-network-manager.yaml
Comment 14 Janek Walkenhorst univentionstaff 2015-06-17 18:16:44 CEST
<http://errata.univention.de/ucs/4.0/211.html>
Comment 15 Philipp Hahn univentionstaff 2015-06-18 08:46:22 CEST
r61349 | Bug #36532: Speed up network re-config
r61350 | Bug #36532: Speed up network re-config
 Change package version numbers according to errata policy

Package: univention-network-manager
Version: 6.0.0-3.108.201506180826
Branch: ucs_4.0-0
Scope: errata4.0-2

Package: univention-directory-notifier
Version: 9.0.3-2.90.201506180824
Branch: ucs_4.0-0
Scope: errata4.0-2

Package: univention-bind
Version: 9.0.5-2.208.201506180830
Branch: ucs_4.0-0
Scope: errata4.0-2

r61351 | Bug #36532: Speed up network re-config YAML
 2015-06-12-univention-bind.yaml
 2015-06-12-univention-directory-notifier.yaml
 2015-06-12-univention-network-manager.yaml
Comment 16 Florian Best univentionstaff 2015-07-02 13:38:05 CEST
>+++ b/ucs-4.0-2/services/univention-bind/conffiles/etc/network/if-down.d/bind9
>+[ -e /etc/init.d/univention-bind9 ] || exit 0
>+invoke-rc.d univention-bind9 reload

> +++ b/ucs-4.0-2/services/univention-bind/conffiles/etc/network/if-up.d/bind9
>+[ -x /etc/init.d/univention-bind9 ] || exit 0
>+invoke-rc.d univention-bind9 reload

→ There is not univention-bind9 but univention-bind!
Comment 17 Philipp Hahn univentionstaff 2015-07-02 13:58:59 CEST
(In reply to Florian Best from comment #16)
...
> → There is not univention-bind9 but univention-bind!

Fixed:
r61666 | Bug #36532 BIND: Improve restart of bind9 on network reconfiguration

Package: univention-bind
Version: 9.0.5-3.209.201507021355
Branch: ucs_4.0-0
Scope: errata4.0-2

r61667 | Bug #36532 BIND: Improve restart of bind9 on network reconfiguration YAML
 2015-06-12-univention-bind.yaml
Comment 18 Florian Best univentionstaff 2015-07-02 17:27:03 CEST
OK: univention-s4-connector
OK: univention-bind
OK: univention-directory-listener
OK: univention-directory-notifier

REOPEN: univention-network-manager

1.)
/etc/network/if-up.d/90_dns_update: 49: /etc/network/if-up.d/90_dns_update: /usr/sbin/univention-register-network-address: not found

2.)
Traceback (most recent call last):
  File "/etc/network/if-up.d/12_univention_config_registry", line 88, in <module>
    ucr_update({'interfaces/restart/auto': 'false'})
TypeError: ucr_update() takes exactly 2 arguments (1 given)
→ missing first parameter configRegistry in both calls

3.) Fixing 2 leads to:
Traceback (most recent call last):
  File "/etc/network/if-up.d/12_univention_config_registry", line 89, in <module>
    ucr_update(configRegistry, ucr_set)
  File "/usr/lib/pymodules/python2.7/univention/config_registry/frontend.py", line 189, in ucr_update
    changed = ucr.update(changes)
  File "/usr/lib/pymodules/python2.7/univention/config_registry/backend.py", line 279, in update
    registry[key] = value
  File "/usr/lib/pymodules/python2.7/univention/config_registry/backend.py", line 422, in __setitem__
    value.decode('UTF-8')  # only accept valid UTF-8 encoded bytes
AttributeError: 'IPv4Address' object has no attribute 'decode'

4.) If 3.) failed (as it does in step 3) the UCR variable interfaces/restart/auto is changed to false.
Comment 19 Florian Best univentionstaff 2015-07-02 18:41:59 CEST
Created attachment 6996 [details]
Screenshot

I had (somehow) a gateway=='' UCR variable set. After this i could not set up the network correctly anymore. A reboot helped.

The rndc blocked some minutes. Shouldn't it be asynchronous?
Comment 20 Philipp Hahn univentionstaff 2015-07-03 11:25:15 CEST
(In reply to Florian Best from comment #18)
> 1.)
> /etc/network/if-up.d/90_dns_update: 49: /etc/network/if-up.d/90_dns_update:
> /usr/sbin/univention-register-network-address: not found

r61720 | Bug #36532 net: Fix removed but not purged package
 Added [ -x ] test


> 2.)
> → missing first parameter configRegistry in both calls

r61716 | Bug #36532 net: Fix setting UCRVs


> 3.) Fixing 2 leads to:
>   File "/usr/lib/pymodules/python2.7/univention/config_registry/backend.py",
> line 422, in __setitem__
>     value.decode('UTF-8')  # only accept valid UTF-8 encoded bytes
> AttributeError: 'IPv4Address' object has no attribute 'decode'

r61716 | Bug #36532 net: Fix setting UCRVs


> 4.) If 3.) failed (as it does in step 3) the UCR variable
> interfaces/restart/auto is changed to false.

r61716 | Bug #36532 net: Fix setting UCRVs
 Re-order UCR code to restore state last.


(In reply to Florian Best from comment #19)
> I had (somehow) a gateway=='' UCR variable set. After this i could not set
> up the network correctly anymore. A reboot helped.

This can happen if the DHCP client was not able to configure the gateway (which can happen, when configuring the IP address fails. The "RTNETLINK answers: File exists" message indicates, that the old address configuration was not flushed when taking down the interface. Debian converted /sbin/dhclient-script to use "iproute" instead of "ifconfig/route/...", which shows such suitable differences)

> The rndc blocked some minutes. Shouldn't it be asynchronous?

The screenshot show "lo" being down.
I can reproduce it with "ifdown -a;rndc status".
Not considered a bug worth fixing, as a downed "lo" break a lot more.


I also removed last code setting UCRV interfaces/*/fallback/*.
The only code left handling that is their removal by USS.
ACKed by Stefan.


Package: univention-network-manager
Version: 6.0.0-5.110.201507031106
Branch: ucs_4.0-0
Scope: errata4.0-2

r61721 | Bug #36532 net: Fix removed but not purged package YAML
 2015-06-12-univention-network-manager.yaml
Comment 21 Florian Best univentionstaff 2015-07-03 12:12:37 CEST
OK: latest changes
OK: YAML
Comment 22 Janek Walkenhorst univentionstaff 2015-07-03 14:06:17 CEST
<http://errata.univention.de/ucs/4.0/223.html>
Comment 23 Janek Walkenhorst univentionstaff 2015-07-03 14:06:32 CEST
<http://errata.univention.de/ucs/4.0/225.html>
Comment 24 Janek Walkenhorst univentionstaff 2015-07-03 14:09:17 CEST
<http://errata.univention.de/ucs/4.0/224.html>
Comment 25 Stefan Gohmann univentionstaff 2015-07-15 21:16:58 CEST
2015-06-12-univention-network-manager.yaml has not been released.

@Florian, is it already verified?
Comment 26 Florian Best univentionstaff 2015-07-16 10:42:05 CEST
(In reply to Stefan Gohmann from comment #25)
> 2015-06-12-univention-network-manager.yaml has not been released.
> 
> @Florian, is it already verified?
yes.

best@univention.de 	2015-07-03 12:12:37 CEST 	Status 	RESOLVED 	VERIFIED
walkenhorst@univention.de 	2015-07-03 14:06:17 CEST 	Status 	VERIFIED 	CLOSED
gohmann@univention.de 	2015-07-15 21:16:58 CEST 	Status 	CLOSED 	RESOLVED
Comment 27 Janek Walkenhorst univentionstaff 2015-07-20 17:51:02 CEST
<http://errata.univention.de/ucs/4.0/247.html>