Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] aufs memory leak
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 45

PostPosted: Wed Apr 23, 2014 4:34 pm    Post subject: [SOLVED] aufs memory leak Reply with quote

I have a Gentoo Linux running on diskless station.
I am using SquashFS image as root filesystem.
Following folders are mounted with AUFS to make them writable: /etc, /home/user, /var/lib, /var/log

I noticed mysterious free space disappearance on /var/lib mount point. Investigation has lead to discovering of the following fact:

Performing
Code:
touch /var/lib/test-file
decreases free space on 4096 bytes. Space is not being freed after
Code:
rm /var/lib/test-file


But doing touch again (with same filename) does not decrease free space.

Same thing would occur on
Code:
echo "" > /var/lib/test-file
wich narrows issue down to:


It takes 4096 bytes to create new file on aufs mount point and this space will not be freed after file deletion. It is also true that space would be subtracted only once per file. Consequent file creations (using same path and name) will not decrease the space.


Could anyone with knowledge on the matter give me advice on what to do to fix it? Should I file a bug report?

Here are some command outputs for reference:

Code:

computer ~ # uname -a
Linux computer 3.13.5-aufs #2 SMP Wed Mar 19 09:52:37 EDT 2014 x86_64 Intel(R) Atom(TM) CPU D2550 @ 1.86GHz GenuineIntel GNU/Linux


Code:

computer ~ # zcat /proc/config.gz | grep "AUFS"
CONFIG_AUFS_FS=y
CONFIG_AUFS_BRANCH_MAX_127=y
# CONFIG_AUFS_BRANCH_MAX_511 is not set
# CONFIG_AUFS_BRANCH_MAX_1023 is not set
# CONFIG_AUFS_BRANCH_MAX_32767 is not set
CONFIG_AUFS_SBILIST=y
# CONFIG_AUFS_HNOTIFY is not set
CONFIG_AUFS_RDU=y
# CONFIG_AUFS_SP_IATTR is not set
# CONFIG_AUFS_SHWH is not set
CONFIG_AUFS_BR_RAMFS=y
# CONFIG_AUFS_BR_FUSE is not set
CONFIG_AUFS_BDEV_LOOP=y
# CONFIG_AUFS_DEBUG is not set


Code:

computer ~ # df
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/loop0        298240 298240         0 100% /
etc-tmpfs         298240 298240         0 100% /aufs/etc
var-tmpfs         298240 298240         0 100% /aufs/var/log
varlib-tmpfs      298240 298240         0 100% /aufs/var/lib
varspool-tmpfs    298240 298240         0 100% /aufs/var/spool
home-tmpfs        298240 298240         0 100% /aufs/home/user
etc-aufs           32768    128     32640   1% /etc
var-aufs           32768    408     32360   2% /var/log
varlib-aufs        16384    864     15520   6% /var/lib
varspool-aufs      16384   1792     14592  11% /var/spool
home-aufs        2560000 120868   2439132   5% /home/user
tmpfs             404800    568    404232   1% /run
udev               10240      0     10240   0% /dev
shm              2023988      0   2023988   0% /dev/shm
cgroup_root        10240      0     10240   0% /sys/fs/cgroup
tmpfs              10240      4     10236   1% /var/lib/misc
tmpfs            1048576      4   1048572   1% /tmp



Code:

computer ~ # mount
/dev/loop0 on / type squashfs (ro,relatime)
etc-aufs on /etc type aufs (rw,relatime,si=ad25961ecb76ef6b)
var-aufs on /var/log type aufs (rw,relatime,si=ad25961ecb76bf6b)
varlib-aufs on /var/lib type aufs (rw,relatime,si=ad25961ecb769f6b)
varspool-aufs on /var/spool type aufs (rw,relatime,si=ad25961f5defff6b)
home-aufs on /home/user type aufs (rw,relatime,si=ad25961f5defcf6b)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,size=404800k,mode=755)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=505344,mode=755)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
cgroup_root on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
openrc on /sys/fs/cgroup/openrc type cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc)
cpuset on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cpu on /sys/fs/cgroup/cpu type cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
cpuacct on /sys/fs/cgroup/cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
freezer on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
tmpfs on /var/lib/misc type tmpfs (rw,relatime,size=10240k)
tmpfs on /tmp type tmpfs (rw,relatime,size=1048576k)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)

_________________
Use GNU/Linux


Last edited by nc-pv on Thu Apr 24, 2014 2:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
nc-pv
n00b
n00b


Joined: 01 Oct 2012
Posts: 45

PostPosted: Thu Apr 24, 2014 2:03 pm    Post subject: Reply with quote

OK. Apparently this is AUFS issue having nothing to do with Gentoo itself. The situation happens only when AUFS is used in combination with TMPFS.

Here are relevant links to find out more about problem and possible solution:

AUFS mail list discussion:

http://sourceforge.net/p/aufs/mailman/aufs-users/thread/7069.1352289200%40jrobl/

ServerFault question with answer (from same person as above link):

http://serverfault.com/a/446402/145512

In summary:

To free up the space immediately remount partition as follows (assume your mount point is /tmp/mnt ):

Code:
# mount -o remount,itrunc_xino=0 /tmp/mnt


To prevent this from happening add following option to mount command (author had mention he does not know will this affect performance of the system):

Code:
# mount -t aufs -n -o "br:/tmp/rw:/usr,trunc_xino" none "/tmp/mnt"

_________________
Use GNU/Linux
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum