Score:0

Memcached throws errors when using it as session handler

bf flag
Tom

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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.