Ext / session concurrency problem example?

I always did the session processing myself using cookies and databases, and not through php ext / session api.

I do this with row locks and necessary isolation. I have never encountered concurrency problems with my method, although I do not think that I have enough traffic to detect such problems.

I was recently told that ext / session does more than you might expect, and that it is harder than I think, which made me question my approach.

Can you give an example of parallel queries and the way in which ext / session resolves data inconsistencies?

+4
source share
1 answer

, , ext/session concurrency . , ( , session_write_close).

, , ( ), .

, , ext/session, .

, PHP SessionHandlerInterface session_set_save_handler, , open close.

:

Connection 1          Connection 2
session open          session open - blocks
session read          //blocked
// do stuff           //blocked
session write         //blocked
session close         //blocked
                      session open returns
                      //reset of session handling as per normal

Connection 2 ( , ), - , , .

, , . , .

+2

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


All Articles