codeigniter4 / codeigniter4/CodeIgniter4

Bug: [Memcached] session_start(): Unable to clear session lock record

未关闭
#7,604 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug can of worms
主要语言
PHP
星标
6k
派生
2k
平均合并
1 天 11 小时
30 天内合并 PR
73

描述

### PHP Version

8.2

### CodeIgniter4 Version

4.3.2

### CodeIgniter4 Installation Method

Composer (using `codeigniter4/appstarter`)

### Which operating systems have you tested for this bug?

Linux

### Which server did you use?

fpm-fcgi

### Database

Mysql 5.7

### What happened?

I have configured session store as memcached, it was working fine in PHP 7.1 with codeIgniter 2,

After upgrading PHP 7.1 to 8.2 and codeIgniter 2 to 4 I am getting an error on multiple async ajax call

```
session_start(): Unable to clear session lock record
in SYSTEMPATH/Session/Session.php on line 928.
1 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler()
2 SYSTEMPATH/Session/Session.php(928): session_start()
3 SYSTEMPATH/Session/Session.php(250): CodeIgniter\Session\Session->startSession()
4 SYSTEMPATH/Config/Services.php(674): CodeIgniter\Session\Session->start()
5 SYSTEMPATH/Config/BaseService.php(252): CodeIgniter\Config\Services::session()
6 SYSTEMPATH/Config/BaseService.php(193): CodeIgniter\Config\BaseService::__callStatic()
7 SYSTEMPATH/Config/Services.php(641): CodeIgniter\Config\BaseService::getSharedInstance()
8 SYSTEMPATH/Config/BaseService.php(252): CodeIgniter\Config\Services::session()
9 SYSTEMPATH/Common.php(988): CodeIgniter\Config\BaseService::__callStatic()
```

codeIgniter official website also suggests to use session_write_close() for resolving this issue. But this did not work for ajax concurrent call.

### Steps to Reproduce

When I am calling multiple sync ajax than getting error

### Expected Output

Getting Json Response

### Anything else?

_No response_

贡献指南

打开贡献指南

调研方向

从 SYSTEMPATH/Session/Session.php 第 928 行开始,跟踪调用 session_start() 的 startSession() 路径。在 PHP 8.2 上使用 Memcached 处理多个并发 AJAX 请求,重现该失败,并将行为与预期的 JSON 响应进行比较。当并发请求不再报告 session lock-record 错误时,问题即得到解决。

由索引模型根据 Issue 内容生成。

评估

技术栈
memcached, php
领域
backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。