[rrd-developers] bus error when disk is full, with mmap & sparse file

Francois-Xavier Bourlet francois-xavier.bourlet at dotcloud.com
Mon Apr 18 01:23:06 CEST 2011


Hello,

On my system rrd_open use mmap and my system support sparse file.
That's mean when my disk get full rdd_open can bus error. Here's the
scenario in rrd_open:

Disk really close to full, few kbytes free
open file -> ok
seek to end -1 -> ok
write 1 -> ok
the system will only write the last chunk of the file, every others
will be allocated lazily later because of the sparse file feature.
So we have a file bigger than the free space available on the system.
Next attempt to write on this file, even without extending the size of
it will fail with a disk full error.

next rrd_open map the file and then
memset to zero the whole file... leading to a buserror since the
kernel can't write into the file because the filesystem is full.

In my case I just have to extend the disk space available and it's
fine. But the problem is you don't have any clue that the bus error
happen because you're disk is full, and I really wasted a lots of time
before I thought simply checking the free space...

I don't really now how to fix the code, maybe we can catch SIGBUS
signals, and when discovering that the error is about a file mapping,
provide an human readable message on terminal/log?

Trying to recover from a bus error on file mapped memory seem to be
another challenge...

Or rather than memsetting the file to zero, we could simply write
zeros in the file before mapping it, and so it would be easy to catch
write error.

Let me know what do you think about it, I am available to patch rrd
with the best proposed solution.

Regards,
-- 
François-Xavier Bourlet

ps: I apologize for my bad English.



More information about the rrd-developers mailing list