将predis更改为phpredis:获取分段错误

问题描述

代码已在Mac上进行了本地测试)

我已经为Redis创建了一个简单的测试,但不幸的是,它失败并显示[1] 27996 segmentation fault

// Config in App.PHP
// Had to rename Redis,because of the use of PHPredis!
'RedisManager' => Illuminate\Support\Facades\Redis::class,//Test unit
use Illuminate\Support\Facades\Redis;

/** @test */
public function it_can_set_a_dummy_value_in_redis()
{
    $value = 'Hello';

    Redis::set($this->cacheKey,$value,'EX',60);

    $this->assertEquals($value,Redis::get($this->cacheKey));
}

在触发命令set时失败。

我仔细检查了代码Illuminate\Redis\Connections\PHPRedisConnection.PHP@command

我检查了$this->client的对象值是什么:

Redis {#2278
  isConnected: true
  host: "127.0.0.1"
  port: 6379
  auth: null
  mode: ATOMIC
  dbnum: 0
  timeout: 0.0
  lastError: null
  persistentId: null
  options: {
    TCP_KEEPALIVE: 0
    READ_TIMEOUT: 0.0
    COMPRESSION: NONE
    SERIALIZER: NONE
    PREFIX: "local_database_"
    SCAN: norETRY
  }
}

我通过以下方式检查连接:

 dd($this->client->ping()); // it's true

但是,它在此时失败了:

return parent::command($method,$parameters); //set is called

即使它位于try-catch-block中,也不会在其中显示...

日志未显示任何内容

  • Nginx:0个错误

  • PHP-fpm:0个错误

  • redis

    2867:M 2020年8月29日22:46:03.142 *背景保护由pid 27498开始 27498:C 2020年8月29日22:46:03.145 * DB已保存在磁盘上 2867:M 2020年8月29日22:46:03.306 *成功完成后台保存

所以Redis也能正常工作。

我不知道发生了什么。当我更改为predis时,一切正常!

我唯一得到的提示this thread。但是由于我的ping()被打了,应该可以吗?

有什么想法可以解决我的问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)