Session Issues When Enabling APC

We have a problem with the PHP session when APC is enabled on our server.

The application works fine without APC. However, since we turned on APC, the sessions seem to mix when the server is under heavy load, that is, users accidentally register as another. When we turned off APC, everything returned to normal. We cannot find anyone with the same problem except the guys associated with this (set-cookie is cached in MS ASP): http://msdn.microsoft.com/en-us/magazine/cc163577.aspx#S2

Does anyone have a similar experience? Can you recommend any suggestions?

PS: We have all of our sessions handled by files in php.ini. We are also running apache2.

+3
source share
4 answers

We have the same problem. APC is only the main suspect at the moment, because it is difficult to reproduce.

We use the Zend Framework w / session management, and the theory is that Zend code is cached in APC, and when the system is under heavy load, the code uses the previously cached SID instead of the current one.

Our protection is to store the session identifier inside the session data and compare the values ​​when retrieving the session. If the identifiers are different, we destroy the session and end it.

+2
source

, , , apc ... , , , - stackoverflow. , maby .

0

APC, . , session_write_close , PHP .

, , .

0

:

1) , , IP , . , .

2) We switched to XCache and immediately saw fewer confusing session identifiers. However, with a very heavy load, the problem returns its ugly head again.

3) Then we double the memory for Xcache in php config (xcache.size and xcache.var_size), and now the problem has disappeared.

Therefore, we suspect that the problem with APC or Xcache has ended. We are still waiting to see if this is a permanent solution.

0
source

Source: https://habr.com/ru/post/1761093/


All Articles