Eliminate SIGBUS errors in parsing metrics
Previously if the underlying filesystem ran of space, reads and writes
to mmap()
regions would throw an ugly SIGBUS error and crash.
Now we use posix_fallocate()
to ensure the underlying region is at
least a page size (4096 bytes) before continuing. An IOError
exception
is raised instead, which should be caught by the caller.
For systems (e.g. MacOS) that do not support posix_fallocate()
, we
fallback to the standard ftruncate()
.
Part of gitlab-org/gitlab#24425 (closed)
Edited by Stan Hu