-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Apple M1/Big Sur - Segfault on RETURN_ZVAL in redis.c when in MULTI or PIPELINE mode #1917
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
Comments
Hi @stefan-valnet, I actually have access to an M1 mac for another project so I will attempt to replicate the crash! |
Thanks @michael-grunder , Tried a recompile on Big Sur 11.2 - still there. Are you able to reproduce the crash? Anything else I can do to help? |
Hi @stefan-valnet, I am able to replicate the problem. Unfortunately, debugging native code in a console is something of a nightmare on M1 macs presently. GDB no longer works at all, and lldb crashes a lot (e.g. printing a variable usually segfaults lldb 11.0). I have tracked it down to a small area:
It may have to do with the fact that I'll try to get a fix up today. Update: I've determined what's causing the problem. It has to do with how we're calling the function pointers during exec. The fix shouldn't be too tough. |
Convert every single Redis callback function to the form: int callback(INTERNAL_FUNCTION_PARAMETERS, RedisSock*, zval*, void*); Additionally, stop typcasting the callback to void* which was suppressing warnings and exposing a segfault on Apple silicon (#1917).
@stefan-valnet Give the linked branch a try if you can. The issue had to do with differences between the x86 and AARCH64 calling conventions, and that we were typecasting a function pointer to Your example now works for me on my rented M1 and tests are passing. |
Thanks @michael-grunder! Confirmed working over here. |
Excellent, I was having SEG FAULT with Redis and Laravel Horizon. @michael-grunder's suggested branch seems to fix this issue. |
Can confirm https://github.com/phpredis/phpredis/tree/issue.1917-callback-segfault works as intended (tested on Laravel + Horizon) If anyone stumbles upon this issue before it's permanently fixed, follow the install instructions in https://github.com/phpredis/phpredis/blob/issue.1917-callback-segfault/INSTALL.markdown and you're done |
@michael-grunder since you merge your changes can we close this issue? |
Expected behaviour
Actual behaviour
I'm seeing this behaviour on
Steps to reproduce, backtrace or example script
Interestingly enough, if $pipe contains just one command, the exec succeeds.
Segfault happens in redis.c
I've checked
develop
branchThe text was updated successfully, but these errors were encountered: