We are trying to use Memcached (1.5.22) as a session handler on a server with Apache + PHP 7.4, however, we have observed random errors with the message below:
session_start(): Failed to read session data: user (path: XX.XX.X.XX:11211)
The application is making AJAX requests, approximately 25 requests in one second, of these 25 requests, few present the error.
Because of that we decided to look at the Memcached error log and noticed that when this error occurs, Memcached returns 3x an error in the log, as below:
238593:May 12 14:09:45 memcached-01 systemd-memcached-wrapper[436]: <32 ADD da_session:b2ZnDAkIZ15vpbhrHHkxoZesSSC6Lgi5:lock Value len is 10
238594-May 12 14:09:45 memcached-01 systemd-memcached-wrapper[436]: >32 Writing an error: Data exists for key.
--
238608-May 12 14:09:45 memcached-01 systemd-memcached-wrapper[436]: <32 0x00 0x00 0x00 0x00
238609:May 12 14:09:45 memcached-01 systemd-memcached-wrapper[436]: <32 ADD da_session:b2ZnDAkIZ15vpbhrHHkxoZesSSC6Lgi5:lock Value len is 10
238610-May 12 14:09:45 memcached-01 systemd-memcached-wrapper[436]: >32 Writing an error: Data exists for key.
--
238624-May 12 14:09:45 memcached-01 systemd-memcached-wrapper[436]: <32 0x00 0x00 0x00 0x00
238625:May 12 14:09:45 memcached-01 systemd-memcached-wrapper[436]: <32 ADD da_session:b2ZnDAkIZ15vpbhrHHkxoZesSSC6Lgi5:lock Value len is 10
238626-May 12 14:09:45 memcached-01 systemd-memcached-wrapper[436]: >32 Writing an error: Data exists for key.
We already tried increase memcached.sess_lock_retries
to 50, disable memcached.sess_locking
, and the error always happens.
memcached.sess_lock_retries 50
memcached.sess_lock_wait not set
memcached.sess_lock_wait_max 2000
memcached.sess_lock_wait_min 150
What could be happening?