Bug 42573

Summary: Listener should check free space
Product: UCS Reporter: Philipp Hahn <hahn>
Component: Listener (univention-directory-listener)Assignee: Philipp Hahn <hahn>
Status: CLOSED FIXED QA Contact: Stefan Gohmann <gohmann>
Severity: normal    
Priority: P5 CC: best, gohmann, orrego, sieverdingbeck
Version: UCS 4.1   
Target Milestone: UCS 4.1-3-errata   
Hardware: Other   
OS: Linux   
See Also: https://forge.univention.org/bugzilla/show_bug.cgi?id=28233
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?: 2: Will only affect a few installed domains How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.114 Enterprise Customer affected?: Yes
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional): Error handling
Max CVSS v3 score:
Bug Depends on: 41842    
Bug Blocks: 42725    
Attachments: 42573.diff

Description Philipp Hahn univentionstaff 2016-10-05 12:44:27 CEST
/var/lib/univention-directory-listener/ got filled up by UDL.
On shutdown UDL writes the handler status using
 src/handlers.c:597 »···state_fp = fopen(state_filename, "w");
this truncates any existing file to zero, which leads to the module being reinitialized on the next start. For 30M objects this takes a long time.

UDL should
1. check the free space itself or
2. write to a new file and do an atomic rename to prevent the state from being lost,
3. write the state from change_new_modules(),
4. check the return value of write() and close() for errors like disk-full.

FYI: univention-directory-replication has its own check: Bug #28232
Comment 1 Philipp Hahn univentionstaff 2016-10-05 14:06:32 CEST
*** Bug 42576 has been marked as a duplicate of this bug. ***
Comment 2 Philipp Hahn univentionstaff 2016-10-14 14:22:07 CEST
r73217 | Bug #42573 listener: Check free space
r73216 | Bug #42573 listener: Abort on failed write
r73210 | Bug #42573 listener: Remove unused dump functions
r73209 | Bug #42573 listener: Mark functions static
r73208 | Bug #42573 listener: Allow compiler flags

Package: univention-directory-listener
Version: 10.0.0-17.333.201610141332
Version: 10.0.0-17.334.201610141418
Branch: ucs_4.1-0
Scope: errata4.1-3

r73231 | Bug #42573 listener: Check free space
r73230 | Bug #42573 listener: Abort on failed write
r73224 | Bug #42573 listener: Remove unused dump functions
r73223 | Bug #42573 listener: Mark functions static

r73242 | Bug #42328,Bug #41960,Bug #41842,Bug #42573 listener: YAML
 univention-directory-listener.yaml
Comment 3 Florian Best univentionstaff 2016-10-14 14:42:55 CEST
svn r73217:
The UCR variable description says KiB for de and MiB for en.
Comment 4 Philipp Hahn univentionstaff 2016-10-14 15:01:53 CEST
(In reply to Florian Best from comment #3)
> svn r73217:
> The UCR variable description says KiB for de and MiB for en.

r73245 | Bug #42573 UDL: Fix variable description for 'listener/freespace'

Package: univention-directory-listener
Version: 10.0.0-18.335.201610141453
Branch: ucs_4.1-0
Scope: errata4.1-3

r73247 | Bug #42573 UDL: Fix variable description for 'listener/freespace' YAML
 univention-directory-listener.yaml
Comment 5 Philipp Hahn univentionstaff 2016-10-17 14:53:20 CEST
Created attachment 8123 [details]
42573.diff

4603a11 Bug #42573 UDL: Fix variable description for 'listener/freespace'
39cecf3 Bug #42573 listener: Check free space
087f0b6 Bug #42573 listener: Abort on failed write
Comment 6 Stefan Gohmann univentionstaff 2016-10-20 10:28:50 CEST
Tests: OK, works as expected. The listener stops the replication if less than 10 MB are available.

Code review: OK

Merge: OK

YAML: OK
Comment 7 Philipp Hahn univentionstaff 2016-10-20 10:32:57 CEST
r73380 | Bug #42573 listener: Initialize UCRV 'listener/freespace'=10 MiB

Package: univention-directory-listener
Version: 10.0.0-19.337.201610201003
Branch: ucs_4.1-0
Scope: errata4.1-3

r73381 | Bug #42573 listener: Initialize UCRV 'listener/freespace'=10 MiB YAML
 univention-directory-listener.yaml

r73382 | Bug #42573 listener: Initialize UCRV 'listener/freespace'=10 MiB
 UCS-4.2


QA:
 /etc/init.d/univention-directory-listener stop
 cd /var/lib/univention-directory-listener
 mount -t tmpfs -o size=12M xxx /var/lib/univention-directory-listener
 cp -pr * /var/lib/univention-directory-listener/
 stat -f /var/lib/univention-directory-listener
 /etc/runit/univention-directory-listener/run &
 udm container/cn modify --dn cn=users,$(ucr get ldap/base) --set description=$RANDOM
 dd bs=1M count=1 if=/dev/zero of=$PWD/fill
 df -h /var/lib/univention-directory-listener
 udm container/cn modify --dn cn=users,$(ucr get ldap/base) --set description=$RANDOM
 # 19.10.16 21:36:10.469  LISTENER    ( ERROR   ) : File system '/var/lib/univention-directory-listener' full: 9 < 10
 umount $PWD
 /etc/init.d/univention-directory-listener start
Comment 8 Janek Walkenhorst univentionstaff 2016-10-20 12:40:46 CEST
<http://errata.software-univention.de/ucs/4.1/311.html>