会话锁定.session_write_close() 不起作用 [英] Session lock. session_write_close() doesn't work

查看:100
本文介绍了会话锁定.session_write_close() 不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

会话锁的话题已经讨论了很多,我知道魔法"session_write_close() 函数.不过……

The topic of session lock is quite much discussed already and I'm aware of "magic" session_write_close() function. However...

我有一个 Ajax 调用,它执行相当长的操作(需要几分钟).为了获得进度信息,我每 10 秒运行一次 Ajax 调用.但是,我看到所有这些调用都处于待处理状态,并在主长调用完成后开始处理.在 Apache 状态中,我看到这些调用处于工作状态.

I have an Ajax call, which performs pretty long operation (takes several minutes). In order to have a progress information I run another Ajax call every 10 seconds. However I see all those calls are pending and start being processed when main long call is finished. In Apache status I see those calls are in working state.

我在第一个脚本中有 session_write_close() 调用.使用 Xdebug 我跟踪了脚本的执行并确保 session_write_close() 被调用为最后一个会话相关的操作,之后没有调用 start_session() .然而,所有随后的调用仍然停止.

I have session_write_close() call in first script. Using Xdebug I've traced execution of the script and ensured session_write_close() is called as a last session related operation and no start_session() is called afterwards. However all consequent calls are still stalled.

我还可能错过什么?

推荐答案

问题似乎与会话锁定无关.我注意到长时间运行的脚本与 MySQL 100% 的 CPU 一起消耗.因为它不是生产服务器,所以我只为 VM 分配了一个 CPU.我向 VM 添加了第二个 CPU,问题就解决了!

It seems the problem wasn't related to session lock. I have noticed the long-running script consumed together with MySQL 100% of CPU. Because it's not production server I had only one CPU assigned to the VM. I've added second CPU to VM and the problem has gone!

这篇关于会话锁定.session_write_close() 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆