work around weird glibc assert #54

Merged
merged 1 commit into from Nov 20, 2015

Conversation

Projects
None yet
1 participant
Owner

hallyn commented Nov 20, 2015

tl;dr realloc only in BATCH_SIZE increments.

longer version
I can't reproduce it separately yet, but on i386 xenial, lxcfs
is failing on reading meminfo, hitting a glibc assertion in malloc.c:

lxcfs: malloc.c:2373: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed.

The relevant glibc code:

/*
If not the first time through, we require old_size to be
at least MINSIZE and to have prev_inuse set.
*/
assert ((old_top == initial_top (av) && old_size == 0) ||
((unsigned long) (old_size) >= MINSIZE &&
prev_inuse (old_top) &&
((unsigned long) old_end & pagemask) == 0));

Signed-off-by: Serge Hallyn serge.hallyn@ubuntu.com

work around weird glibc assert
tl;dr realloc only in BATCH_SIZE increments.

longer version
I can't reproduce it separately yet, but on i386 xenial, lxcfs
is failing on reading meminfo, hitting a glibc assertion in malloc.c:

lxcfs: malloc.c:2373: sysmalloc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) - __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >= (unsigned long)((((__builtin_offsetof (struct malloc_chunk, fd_nextsize))+((2 *(sizeof(size_t))) - 1)) & ~((2 *(sizeof(size_t))) - 1))) && ((old_top)->size & 0x1) && ((unsigned long) old_end & pagemask) == 0)' failed.

The relevant glibc code:

  /*
     If not the first time through, we require old_size to be
     at least MINSIZE and to have prev_inuse set.
   */
  assert ((old_top == initial_top (av) && old_size == 0) ||
          ((unsigned long) (old_size) >= MINSIZE &&
           prev_inuse (old_top) &&
           ((unsigned long) old_end & pagemask) == 0));

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>

hallyn added a commit that referenced this pull request Nov 20, 2015

@hallyn hallyn merged commit dd2aa06 into lxc:master Nov 20, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment