• Yuta Kitamura's avatar
    base: Prevent SIGBUS by preallocating shared memory file. · a518f634
    Yuta Kitamura authored
    We have some crash reports for Linux that tell us that processes are
    sometimes getting killed with SIGBUS when they write to memory mapped
    to shared memory file. The suspected cause is /dev/shm volume getting
    full.
    
    This CL is an attempt to avoid this by using posix_fallocate() instead
    of ftruncate(), which preallocates memory early and detects disk full
    before we write to memory.
    
    The code is only enabled for Linux, because we currently see the symptom
    happening only on Linux.
    
    Bug: 1014296
    Change-Id: I45c5f4152639a742da689472b73c5e1dd717a2d7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895028Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
    Commit-Queue: Yuta Kitamura <yutak@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#712524}
    a518f634
shared_memory_posix.cc 7.36 KB