Closed aheissenberger closed 5 years ago
As this is popping as first result on Google, in case anyone bumping on this error on Magento 1.X, this can be fixed by rewriting Mage_Index_Model_Resource_Helper_Mysql4
and changing setLock
, releaseLock
and isLocked
methods changing $name
by sha1($name)
in query as advised in quick fix link.
Thank you for this!
stack trace
Environment:
php.ini: session.hash_function=sha512
to store the bigger session key you need:
ALTER TABLE session_data CHANGE session_id session_id VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '';
mySQL Version: >=5.7.5
Test Cases maximum valid key length: 64 characters
SELECT GET_LOCK('1234567890123456789012345678901234567890123456789012345678901234', '5');
fails with everything bigger:
SELECT GET_LOCK('12345678901234567890123456789012345678901234567890123456789012345', '5');
mysql error:
Incorrect user-level lock name '12345678901234567890123456789012345678901234567890123456789012345'.
aditional information the key length got smaller since the new implementation of GET_LOCK in mySQL 5.7.5 https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_get-lock https://github.com/go-sql-driver/mysql/issues/385
quick fix https://github.com/aheissenberger/Zebra_Session/commit/f84d0dfe9b7d572e73e4a6753edb74a406a30073
But I think it would better to create an extra column which contains this key to remove the constant creation of this key on every read request.
Additional I would suggest to add the information about different possible session key length based on the php.ini setting
session.hash_function
as this is very often set by the provider.