Welcome Guest, Not a member yet? Register   Sign In
Issues on database session / session driver
#3

(This post was last modified: 02-10-2020, 05:43 AM by UC_SUJITH.)

(02-10-2020, 04:30 AM)Goddard Wrote: What are your PHP ini settings for the garbage collector?

session.gc_divisor=0
session.gc_probability=0
session.gc_maxlifetime=1440
session.use_cookies=1
session.use_only_cookies=1
session.use_strict_mode=0

Garbage collector is working fine, because ci_sessions table contains sessions only from 2020-02-10 (today). And one more thing, I have checked the below file (codeigniter built-in session driver file for database sessions):

 /system/libraries/Session/drivers/Session_database_driver.php

I found there is a lock of 5 minutes! I didn't understand why they are locking a row (i doubt they are locking the entire table for 5 minutes!) for 300 seconds. I have reduced that to 150 seconds and the count of dead lock occurring has been reduced now. Also found there is another thing inside the session library file:

/system/libraries/Session/Session.php

The function "sess_regenerate" simply calling the php session_regenerate_id(). As per the php manual, session_regenerate_id() will not handle unstable networks such as Mobile and Wifi and the session value may lose. I think, this can be the reason behind creating multiple sessions for a single user. That is, somehow php or apache identified my network as unstable and session library couldn't handle this situation. I think, Codeigniter native session library is not enough for my application.
Reply


Messages In This Thread
RE: Issues on database session / session driver - by UC_SUJITH - 02-10-2020, 05:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB