且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP会话中的错误数据

更新时间:2023-11-13 20:43:46


每次发生这种情况时,地址混杂的用户都有恰好在同一时间(+/- 2秒)登录。我尝试通过同时登录两个不同的用户并比较会话数据来尝试重现此错误。

Each time this happened, the users whose addresses got mixed up, had logged in at the exact same time (+- 2 seconds). I unsuccessfully tried to reproduce this by logging in with two different users at the same time and comparing the Session data.

您描述的问题发生这种情况的原因很可能是由于过度的缓存和/或一端或另一端的数据泄漏问题。

The problem you describe has most likely arisen because of overzealous caching and / or problems with data leakage at one end or the other.

我认为,会话不太可能在会话开始时变得混乱PHP结束-但是您的代码中的会话别名可能存在问题。了解您的PHP实例是否以分叉的进程或线程运行会很有帮助。

I think its very unlikely that the sessions are getting confused at the PHP end - however there may be problems with session aliasing in your code. It would have been helpful to know if your PHP instances are running as forked processes or threads.

测试问题是否在远程服务器上的正确方法(即远程服务器使用线程的可能性要大得多)是对操作进行脚本编写-不使用浏览器-并使用不同的凭据对运行测试数百次-而不是一次。

The right way to test if the problem is on the remote server (which is significantly more likely of the remote server uses threading) is to script the operation - NOT use a browser - and run the test hundreds of times with different pairs of credentials - not just once.