pathfinder icon indicating copy to clipboard operation
pathfinder copied to clipboard

When using php-redis 5.3.1, get 500 error

Open KagurazakaNyaa opened this issue 4 years ago • 13 comments

After using pecl install redis to update php-redis to version 5.3.1, a 500 error occurred when accessing the map. Also found in the error log of nginx 2020/08/24 15:29:50 [error] 7296#7296: *355458 FastCGI sent in stderr: "PHP message: Redis::set(): EXPIRE can't be < 1PHP message: [index.php:27] Base->run()" while reading response header from upstream, client: 162.158.7.131, server: map.waw-eve.com, request: "GET /api/Map/initData HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.3-fpm.sock:", host: "map.waw-eve.com", referrer: "https://map.waw-eve.com/map"

KagurazakaNyaa avatar Aug 24 '20 08:08 KagurazakaNyaa

Can confirm, receiving the same error.

jediefe avatar Aug 24 '20 17:08 jediefe

yep. Confirm.

@exodus4d, Reproducing for next routes: /api/Map/initData /api/Map/getAccessData /api/User/getEveServerStatus

xrem avatar Aug 24 '20 19:08 xrem

Downgraded to 5.2.1 for now.

Temporary fix: pecl install redis-5.2.1

xrem avatar Aug 24 '20 19:08 xrem

same error a little bump for an issue ?

AlfLife-eve avatar Sep 17 '20 19:09 AlfLife-eve

Im Having the same problem but installed redis via apt-get and no previous version available. Uninstalled and tried with pecl but having problems getting php to see the extension with pecl install. Any help would be mega appreciated as we are really stuck :( @exodus4d

TilleyTech avatar Oct 31 '20 09:10 TilleyTech

FYI anyone having this issue and struggling to downgrade using pecl it seems pecl only installs to latest version of php installed even if your using a previous. I had php 7.2 and 7.4 installed but was using 7.2 however pecl only would install to 7.4 ive switched to 7.4 and installed the previous redis and its now working

TilleyTech avatar Oct 31 '20 10:10 TilleyTech

I am having the same error

ghost avatar Dec 31 '20 04:12 ghost

I have this issue as well. Is there no way to get it to work with my version of Redis? Downgrading to 5.2.1 is problematic for me: I have other applications on this server using Redis.

Redis server v=6.0.6 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=ca474e00afe358bb

tohuw avatar Mar 22 '21 17:03 tohuw

Ran into this issue running the redis:5-alpine image

Redis server v=5.0.12 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=3ff07df6493cf0b8

Kaezon avatar Apr 10 '21 21:04 Kaezon

As a follow-up, I tested with the 6-alpine, 5-alpine, 4-alpine, and 3-alpine tags. All gave me the same issue

Kaezon avatar Apr 10 '21 23:04 Kaezon

Did a little more digging. Looking at vendor/bcosca/fatfree-core/base.php:2638 there's this line: return $this->ref->set($ndx,$data,$ttl?['ex'=>$ttl]:[]);

I went ahead and added two debug lines:

error_log('DEBUG: ttl=' . $ttl);
error_log('ex>ttl=' . print_r(['ex'=>$ttl], true));

This netted me a little more info. The set() function is called several times before the failure, with ttl values of 3, 120, and 60, but then it's called with a value of 0, which results in the error:

[11-Apr-2021 00:33:09 UTC] DEBUG: ttl= 0
[11-Apr-2021 00:33:09 UTC] ex>ttl=Array
(
    [ex] =>  0
)

[11-Apr-2021 00:33:09 UTC] Redis::set(): EXPIRE can't be &lt; 1
[11-Apr-2021 00:33:09 UTC] [vendor/bcosca/fatfree-core/base.php:2347] Base->error()
[11-Apr-2021 00:33:09 UTC] [vendor/bcosca/fatfree-core/base.php:2640] Redis->set()
[11-Apr-2021 00:33:09 UTC] [vendor/bcosca/fatfree-core/base.php:1766] Cache->set()
[11-Apr-2021 00:33:09 UTC] [index.php:27] Base->run()

Just need to figure out what function is calling it with this value and where the value is coming from now.

Kaezon avatar Apr 11 '21 00:04 Kaezon

Looks like ttl is being set on vendor/bcosca/fatfree-core/base.php line 1698: list($handler,$ttl,$kbps,$alias)=$route[$this->hive['VERB']];

By dumping $route, I got several of these:

[11-Apr-2021 01:02:57 UTC] DEBUG -- ROUTE: Array
(
    [GET] => Array
        (
            [0] => Exodus4D\Pathfinder\Controller\Api\@controller->@action
            [1] =>  0
            [2] =>  512
            [3] =>
        )

    [POST] => Array
        (
            [0] => Exodus4D\Pathfinder\Controller\Api\@controller->@action
            [1] =>  0
            [2] =>  512
            [3] =>
        )

)

They appear to be routes from routes.ini, and you can see all of them have a $ttl of 0. I went ahead and tested setting all of the 0's in routes.ini to 1, and it started working.

As an example: GET|POST /api/@controller/@action [ajax] = {{ @NAMESPACE }}\Controller\Api\@controller->@action, 1, 512

Kaezon avatar Apr 11 '21 01:04 Kaezon

Thanks @Kaezon , I'm using Redis 6.2.5 with PHP 7.4 and been pulling my hair out for the past 2 days until I found that workaround!

beelitzs avatar Sep 22 '21 13:09 beelitzs