Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alignment issues on armhf in chunked items #409

Closed
dormando opened this issue Jul 9, 2018 · 4 comments
Closed

alignment issues on armhf in chunked items #409

dormando opened this issue Jul 9, 2018 · 4 comments

Comments

@dormando
Copy link
Member

dormando commented Jul 9, 2018

my rpi3 with alignment checking (Aarch64) fails all over the place, but never in t/chunked-items.t no matter what I do. for some reason that alignment is fine; or gcc/glibc is no longer doing something clever that it used to do.

https://wiki.ubuntu.com/ARM/RaspberryPi
^ note for self, ARMHF is the specific platform failing on their end. I can try this image on my rpi2 and see if the specific failure can be reproduced... else try the arm64 images. think I found a 4G sd card I can use for this.

Probably have to stick an #ifdef NEED_ALIGN to pad bytes before the chunked item header, given that key comes before ITEM_data() it can't be naturally aligned to the struct.

https://bugs.launchpad.net/memcached/+bug/1780838 (ubuntu bug for ref)

@basak
Copy link

basak commented Jul 9, 2018

With dormando's help we eventually pinned this down to:

(gdb) bt
#0  do_item_alloc (key=0xf5a22a70 "t", 'd' <repeats 199 times>..., nkey=1, 
    flags=0, exptime=0, nbytes=nbytes@entry=7905) at items.c:344
#1  0x00430a10 in item_alloc (key=<optimized out>, nkey=<optimized out>, 
    flags=<optimized out>, exptime=<optimized out>, nbytes=7905)
    at thread.c:549
#2  0x00415e36 in process_bin_update (c=<optimized out>) at memcached.c:2432
#3  complete_nread_binary (c=<optimized out>) at memcached.c:2640
#4  0x0041f1b6 in complete_nread (c=0xf5a20670) at memcached.c:2697
#5  drive_machine (c=0xf5a20670) at memcached.c:5511
#6  0x00421134 in event_handler (fd=<optimized out>, which=<optimized out>, 
    arg=0xf5a20670) at memcached.c:5755
#7  0xf7799558 in ?? () from /usr/lib/arm-linux-gnueabihf/libevent-2.1.so.6
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 

This is with the released items.c from released 1.5.9.

@dormando
Copy link
Member Author

can't get my rpi2 to boot that armhf image :( tried the contrib rpi3 image and it's not running with restricted alignment. NEED_ALIGN isn't detected and it passes all tests.

debating what to try next. getting arm64 to boot looks a little involved, need to reserve more time for it.

@dormando
Copy link
Member Author

finally

armhf rpi3 experimental build for ubuntu 18.04 specifically (debian's never trip somehow).

echo 4 > /proc/cpu/alignment

[Switching to Thread 0x75c30460 (LWP 7762)]
do_item_alloc (key=0x75322a70 "t", 'd' <repeats 199 times>..., nkey=1, flags=0, 
    exptime=0, nbytes=nbytes@entry=7905) at items.c:344
344	        chunk->size = 0;

sadly, fixing this looks painful. subsequent chunks are dealt with properly, but the "first chunk" is dereferenced in a lot of places. trying to come up with a fetch macro that auto-pads.

@dormando
Copy link
Member Author

fix released. closing this out, hopefully it won't bounce back :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants