This problem may be related to some mmap bug of your old Centos distribution.
If upgrading to a newer version is not an option, you could try to compile your rrdtool
with the following option:
./configure --disable-mmap
By doing so, the faulty memcpy
at line 716 in the rrd_write()
function (shown below) should not be executed:
/* Write count bytes from buffer buf to the current position
* rrd_file->pos of rrd_simple_file->fd.
* Returns the number of bytes written or <0 on error. */
ssize_t rrd_write(
rrd_file_t *rrd_file,
const void *buf,
size_t count)
{
rrd_simple_file_t *rrd_simple_file = (rrd_simple_file_t *)rrd_file->pvt;
#ifdef HAVE_MMAP
size_t old_size = rrd_file->file_len;
if (count == 0)
return 0;
if (buf == NULL)
return -1; /* EINVAL */
if((rrd_file->pos + count) > old_size)
{
rrd_set_error("attempting to write beyond end of file");
return -1;
}
memcpy(rrd_simple_file->file_start + rrd_file->pos, buf, count);
rrd_file->pos += count;
return count; /* mimmic write() semantics */
#else
ssize_t _sz = write(rrd_simple_file->fd, buf, count);
if (_sz > 0)
rrd_file->pos += _sz;
return _sz;
#endif
}