Details
-
Bug
-
Resolution: Fixed
-
Medium
-
None
-
None
-
eZ Publish 4.6
Description
We can get the following errors when we have two users searching for the same phrase at the same time:
[ Dec 13 2012 15:25:46 ] [127.0.0.1] eZMySQLiDB: Query error (1062): Duplicate entry 'ez' for key 'ezsearch_search_phrase_phrase'. Query: INSERT INTO ezsearch_search_phrase ( phrase, phrase_count, result_count ) VALUES ( 'ez', 1, 32 ) [ Dec 13 2012 15:25:46 ] [127.0.0.1] eZDBInterface::commit TRANSID-d38a19ea5c412d395dec65ca1c95b84b: Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is TRANSID-d38a19ea5c412d395dec65ca1c95b84b.
This can happen when the phrase is searched for the first time, and if another user searches for the same phrase the transaction fails.
Steps to reproduce:
1. Use Apache Bench to generate some load to your site, searching for the same keyword.
You can use for example: ab -n 2000 -c 5 http://localhost/site/index.php/content/search?SearchText=SOMETHING&SearchButton=Search
2. Log into your database and delete the entry generated for the search phrase.
For example you can use this query: DELETE FROM `your_database`.`ezsearch_search_phrase` WHERE `ezsearch_search_phrase`.`phrase` = "SOMETHING";
3. Continue on deleting the entry until you see the errors in error log.
Deleting the entry is optional, but please take in mind that this issue happens randomly, so it may occur on a random basis. Consider this only a trick to help on reproducing this bug more easily.