[Varnish] #1792: If few free space and file-storage on xfs, Varnish does not restart.

Varnish varnish-bugs at varnish-cache.org
Mon Sep 14 09:23:48 CEST 2015


#1792: If few free space and file-storage on xfs, Varnish does not restart.
-------------------------+----------------------
 Reporter:  xcir         |       Type:  defect
   Status:  new          |   Priority:  normal
Milestone:               |  Component:  varnishd
  Version:  4.1.0-beta1  |   Severity:  normal
 Keywords:               |
-------------------------+----------------------
 Hi, I got an error message that "Error: (-sfile) allocation error: No
 space left on device" at the time of varnish restart.


 Environment:
 {{{
 varnishd (varnish-4.1.0-beta1 revision 1628f0b)
 Linux varnish-trunk 3.13.0-49-generic #83-Ubuntu SMP Fri Apr 10 20:11:33
 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 14.04.2 LTS)

 Filesystem     Type 1K-blocks  Used Available Use% Mounted on
 /dev/xvdh      xfs   15718400 32928  15685472   1% /mnt/xfs
 }}}

 Log(xfs / Fail)
 {{{
 root at varnish-trunk:~/varnish-4.1.0-beta1# df -T /mnt/xfs
 Filesystem     Type 1K-blocks  Used Available Use% Mounted on
 /dev/xvdh      xfs   15718400 32928  15685472   1% /mnt/xfs

 root at varnish-trunk:~/varnish-4.1.0-beta1# /etc/init.d/varnish start
  * Starting HTTP accelerator varnishd
    ...done.

 root at varnish-trunk:~/varnish-4.1.0-beta1# df -T /mnt/xfs
 Filesystem     Type 1K-blocks     Used Available Use% Mounted on
 /dev/xvdh      xfs   15718400 10518688   5199712  67% /mnt/xfs

 root at varnish-trunk:~/varnish-4.1.0-beta1# du -sb
 /mnt/xfs/varnish_storage.bin
 10737418240     /mnt/xfs/varnish_storage.bin

 root at varnish-trunk:~/varnish-4.1.0-beta1# ps axut|grep varn
 varnish  14687  0.0  0.2 124768  5384 ?        Ss   14:43   0:00
 /usr/local/sbin/varnishd -P /run/varnishd.pid -a :6081 -T localhost:6082
 -f /etc/varnish/default.vcl -S /etc/varnish/secret -p
 thread_pool_stack=512k -s malloc,256m -s
 xfs=file,/mnt/xfs/varnish_storage.bin,10G
 varnish  14689  0.0  5.9 11074296 119456 ?     Sl   14:43   0:00
 /usr/local/sbin/varnishd -P /run/varnishd.pid -a :6081 -T localhost:6082
 -f /etc/varnish/default.vcl -S /etc/varnish/secret -p
 thread_pool_stack=512k -s malloc,256m -s
 xfs=file,/mnt/xfs/varnish_storage.bin,10G
 root     15168  0.0  0.0   8860   644 pts/1    R+   14:49   0:00 grep
 --color=auto varn

 root at varnish-trunk:~/varnish-4.1.0-beta1# /etc/init.d/varnish restart
 Error: (-sfile) allocation error: No space left on device
  * Syntax check failed, not restarting
 }}}

 Log(ext4 / Success)
 {{{

 root at varnish-trunk:~/varnish-4.1.0-beta1# df -T /mnt/ext4
 Filesystem     Type 1K-blocks  Used Available Use% Mounted on
 /dev/xvdi      ext4  15350768 38384  14509568   1% /mnt/ext4

 root at varnish-trunk:~/varnish-4.1.0-beta1# /etc/init.d/varnish start
  * Starting HTTP accelerator varnishd
    ...done.

 root at varnish-trunk:~/varnish-4.1.0-beta1# df -T /mnt/ext4
 Filesystem     Type 1K-blocks     Used Available Use% Mounted on
 /dev/xvdi      ext4  15350768 10524148   4023804  73% /mnt/ext4

 root at varnish-trunk:~/varnish-4.1.0-beta1# du -sb
 /mnt/xfs/varnish_storage.bin
 10737418240     /mnt/xfs/varnish_storage.bin

 root at varnish-trunk:~/varnish-4.1.0-beta1# ps axut|grep varn
 varnish  15639  0.0  0.2 124768  5376 ?        Ss   14:56   0:00
 /usr/local/sbin/varnishd -P /run/varnishd.pid -a :6081 -T localhost:6082
 -f /etc/varnish/default.vcl -S /etc/varnish/secret -p
 thread_pool_stack=512k -s malloc,256m -s
 ext4=file,/mnt/ext4/varnish_storage.bin,10G
 varnish  15641  0.3  5.8 11074296 117260 ?     Sl   14:56   0:00
 /usr/local/sbin/varnishd -P /run/varnishd.pid -a :6081 -T localhost:6082
 -f /etc/varnish/default.vcl -S /etc/varnish/secret -p
 thread_pool_stack=512k -s malloc,256m -s
 ext4=file,/mnt/ext4/varnish_storage.bin,10G
 root     15904  0.0  0.0   8860   640 pts/1    S+   14:56   0:00 grep
 --color=auto varn

 root at varnish-trunk:~/varnish-4.1.0-beta1# /etc/init.d/varnish restart
 ...

  * Stopping HTTP accelerator varnishd
    ...done.
  * Starting HTTP accelerator varnishd
    ...done.
 }}}

 The cause is to fail to fallocate in libvarnish/vfil.c (Even if
 "(st.st_blocks * 512) + fsspace >= size")

  https://github.com/varnish/Varnish-
 Cache/blob/117c2bdcfbb8c11f48bd9137e76edfc746dfbe71/lib/libvarnish/vfil.c#L188

 I think not require fallocate, if "st_blocks * 512" is greater than
 st_size.
 Because already allocated.

 Log(patched)
 {{{
 root at varnish-trunk:~/varnish-4.1.0-beta1# df -T /mnt/xfs
 Filesystem     Type 1K-blocks  Used Available Use% Mounted on
 /dev/xvdh      xfs   15718400 32928  15685472   1% /mnt/xfs
 root at varnish-trunk:~/varnish-4.1.0-beta1# /etc/init.d/varnish start
  * Starting HTTP accelerator varnishd
    ...done.
 root at varnish-trunk:~/varnish-4.1.0-beta1# df -T /mnt/xfs
 Filesystem     Type 1K-blocks     Used Available Use% Mounted on
 /dev/xvdh      xfs   15718400 10518688   5199712  67% /mnt/xfs


 root at varnish-trunk:~/varnish-4.1.0-beta1# du -sb
 /mnt/xfs/varnish_storage.bin
 10737418240     /mnt/xfs/varnish_storage.bin

 root at varnish-trunk:~/varnish-4.1.0-beta1# ps axut|grep varn
 varnish  20804  0.0  0.2 124768  5380 ?        Ss   16:20   0:00
 /usr/local/sbin/varnishd -P /run/varnishd.pid -a :6081 -T localhost:6082
 -f /etc/varnish/default.vcl -S /etc/varnish/secret -p
 thread_pool_stack=512k -s malloc,256m -s
 xfs=file,/mnt/xfs/varnish_storage.bin,10G
 varnish  20806  0.1  5.9 11074296 119308 ?     Sl   16:20   0:00
 /usr/local/sbin/varnishd -P /run/varnishd.pid -a :6081 -T localhost:6082
 -f /etc/varnish/default.vcl -S /etc/varnish/secret -p
 thread_pool_stack=512k -s malloc,256m -s
 xfs=file,/mnt/xfs/varnish_storage.bin,10G
 root     21026  0.0  0.0   8860   648 pts/1    S+   16:21   0:00 grep
 --color=auto varn

 root at varnish-trunk:~/varnish-4.1.0-beta1# /etc/init.d/varnish restart
 ...

  * Stopping HTTP accelerator varnishd
    ...done.
  * Starting HTTP accelerator varnishd
    ...done.

 }}}

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1792>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator



More information about the varnish-bugs mailing list