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

Illegal hardware instruction #2421

Open
arrowak opened this issue Nov 21, 2023 · 6 comments
Open

Illegal hardware instruction #2421

arrowak opened this issue Nov 21, 2023 · 6 comments
Assignees

Comments

@arrowak
Copy link

arrowak commented Nov 21, 2023

Expected behaviour

new RedisCluster() statement to successfully create connection with the Redis cluster.

Actual behaviour

Program exits immediately with below output when I do CLI invocation php redistest.php -

[1]    51431 illegal hardware instruction  php redistest.php

Program exits immediately with below error when I invoke via PHP-FPM -

2023/11/21 08:43:23 [error] 46743#0: *14 kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /redistest.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9081", host: localhost

I'm seeing this behaviour on

  • OS: macOS Sonoma Version 14.0 (23A344)
  • Redis: 5.0.3
  • PHP: 8.1.25
  • phpredis: 6.0.2

Steps to reproduce, backtrace or example script

Example script below -

<?php

$hosts = explode(",", "0.0.0.0:6380,0.0.0.0:6381,0.0.0.0:6382,0.0.0.0:6383,0.0.0.0:6384");
$redis = new RedisCluster(null, $hosts, 500, 500, true);
var_dump($redis);

I have also tried various PHP versions (7.2.3, 7.4.33, 8.1.25) to rule out any PHP issues.
I have also tried various phpredis versions (6.0.2, 6.0.1, 5.3.7, develop branch).
I have tried manually building the extension as well as from the pecl package manager.

I have been getting same behaviour as mentioned above. I remember this used to work fine before I upgraded to macOS Sonoma. Has this something to do with the OS?

I've checked

  • [ ✅ ] There is no similar issue from other users
  • [ ✅ ] Issue isn't fixed in develop branch
@michael-grunder michael-grunder self-assigned this Nov 21, 2023
@michael-grunder
Copy link
Member

I can't replicate this (at least not on macOS 13.0).

I'll see about upgrading and then try again.

@arrowak
Copy link
Author

arrowak commented Nov 21, 2023

I can't replicate this (at least not on macOS 13.0).

I'll see about upgrading and then try again.

I am on Intel based Macbook Pro 2019 (2.6 GHz 6-Core Intel Core i7), in case this helps.

@arrowak
Copy link
Author

arrowak commented Nov 21, 2023

@michael-grunder I was able to pull the process crash dump for the CLI invocation.
Attaching the same in this comment. You can view it in your Console App.

php-2023-11-21-171837.ips.zip

Hopefully this will shed some light 🤞.

@michael-grunder
Copy link
Member

Yep, that narrows it down a great deal. It's such a small surface area that I bet we can track down what might be going on.

Unfortunately I don't have a new enough x86-64 mac to upgrade to macOS 14. I will try to take a stab at what's going on though.

Another thing that might be useful is if you were to attach the actual redis.so file you are using. I could use reverse engineering tools to find the failing instruction.

@arrowak
Copy link
Author

arrowak commented Nov 22, 2023

Appreciate your timely response, buddy.
redis.so here you go. I was using 5.3.7 during the crash dump that I shared.
redis.so.zip

In the meantime, I tried to do my best to analyse what's wrong. I am no C expert, but it seems like the crash is initiated from the zend_hash_str_update_ptr() function from zend_hash.h of PHP source. After some searching, I learnt that the illegal hardware instruction is raised when the variable/data structure goes out of bounds. I am not sure if any C lang related defaults have changed, along with Sonoma upgrade, which phpredis is yet to handle.

I might be completely wrong. Will let the expert speak. Over to you @michael-grunder 😀.

@arrowak
Copy link
Author

arrowak commented Nov 27, 2023

I can confirm that this works fine on MacOS Ventura. I tried the installation and same script. Works fine.

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

No branches or pull requests

2 participants