Project

General

Profile

Actions

Bug #90977

closed

possible race condition in indexedsearch

Added by Jonas Eberle over 4 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Indexed Search
Target version:
-
Start date:
2020-04-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

During artificially high load on a dev system (9.5.15) with 6 php-fpm threads I am able to provoke

An exception occurred while executing 'INSERT INTO `index_words` (`wid`, `baseword`, `metaphone`) VALUES (?, ?, ?)' with params [139691952, "gelungenen", "99353181"]: Duplicate entry '139691952' for key 'PRIMARY'

Backtrace:

...
at TYPO3\CMS\Core\Database\Connection->insert('index_words', array('wid' => 139691952, 'baseword' => 'gelungenen', 'metaphone' => '99353181'))
in /var/www/html/src/public/typo3/sysext/indexed_search/Classes/Indexer.php line 2170

at TYPO3\CMS\IndexedSearch\Indexer->checkWordList(array('unkomplizierte' => array('first' => 1, 'hash' => 19668563, 'metaphone' => '1229927', 'count' => 1), 'flügelkonzept' => array('first' => 5, 'hash' => 180729245, 'metaphone' => '146113107', 'count' => 1), 'neuesten' => array('first' => 10, 'hash' => 188782041, 'metaphone' => '67006256', 'count' => 1), 'erkenntnisse' => array('first' => 11, 'hash' => 15462739, 'metaphone' => '180751463', 'count' => 4), 'forschung' => array('first' => 13, 'hash' => 152791788, 'metaphone' => '99883556', 'count' => 1), 'langjährigen' => array('first' => 16, 'hash' => 82744380, 'metaphone' => '128523246', 'count' => 1), 'mflugzeugen' => array('first' => 23, 'hash' => 38128782, 'metaphone' => '7174348', 'count' => 1), 'resultat' => array('first' => 25, 'hash' => 209439804, 'metaphone' => '167262399', 'count' => 2), 'harmlose' => array('first' => 32, 'hash' => 251103929, 'metaphone' => '204428637', 'count' => 1), 'gleitleistung' => array('first' => 36, 'hash' => 132977964, 'metaphone' => '31057351', 'count' => 1), 'offenen' => array('first' => 44, 'hash' => 215076010, 'metaphone' => '7547654 ...

This seems to be a race condition as it does not show itself under low loads. Yet it is very seldom.


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #101249: Prevent exception caused by hash collisions in indexed_searchClosed2023-07-05

Actions
Related to TYPO3 Core - Task #102975: Use full md5 hash for `indexed_search`ClosedStefan Bürk2024-01-29

Actions
Is duplicate of TYPO3 Core - Bug #84541: Uncaught TYPO3 Exception in indexed_search: duplicate key (hash) errorClosed2018-03-27

Actions
Actions #1

Updated by Xavier Perseguers about 3 years ago

Didn't investigate with load (unsure there's a high load at all) but can reproduce this problem under TYPO3 v10.

Actions #2

Updated by Jonas Eberle about 3 years ago

I suspected it was about 2 threads concurrently indexing and racing checks for "term exists already" vs. persisting, but it might also only depend on a specific current state + newly indexed terms.

I would love to have a reproducible case but wasn't able to come up with one.

Actions #3

Updated by Xavier Perseguers about 3 years ago

  • Related to Bug #84541: Uncaught TYPO3 Exception in indexed_search: duplicate key (hash) error added
Actions #4

Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #5

Updated by Sybille Peters over 2 years ago

@Jonas I do not think it is a race condition and has nothing to do with load on the system. The error message "Duplicate entry" - looks like it is the same as #84541. - hash collison. I may be wrong - but I excessively looked into this problem and what you wrote above very much looks like it.

You can also look in the stack trace.

The nature of this error is that the hash collision depends on if there is a hash collision (which depends on which words are indexed). The error will only occur when the page is indexed (which is usually on the initial load). If you change the page and reload, it will be indexed (depends on configuration). After another reload, it will not - so you will not see the error the next time you reload the page.

If I am right, this issue could be closed as duplicate.

Actions #6

Updated by Sybille Peters over 2 years ago

For a reproducible test case, look at : https://forge.typo3.org/issues/84541#Reproduce

I have not tested this for a while, but should still give you the same result.

Actions #7

Updated by Jonas Eberle over 2 years ago

  • Status changed from Under Review to Closed

Yes, I am fine with closing as duplicate.

I could not reproduce (after truncating indexed_search tables) when indexing with only 1 thread but this is now 2 versions in the past and I cannot reproduce with this exact site any more.

Actions #8

Updated by Jonas Eberle over 2 years ago

  • Related to deleted (Bug #84541: Uncaught TYPO3 Exception in indexed_search: duplicate key (hash) error)
Actions #9

Updated by Jonas Eberle over 2 years ago

  • Is duplicate of Bug #84541: Uncaught TYPO3 Exception in indexed_search: duplicate key (hash) error added
Actions #10

Updated by Gerrit Code Review over 2 years ago

  • Status changed from Closed to Under Review

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #11

Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #12

Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #13

Updated by Gerrit Code Review over 2 years ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #14

Updated by Gerrit Code Review over 2 years ago

Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #15

Updated by Gerrit Code Review over 2 years ago

Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #16

Updated by Gerrit Code Review over 2 years ago

Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #17

Updated by Gerrit Code Review over 2 years ago

Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #18

Updated by Gerrit Code Review over 1 year ago

Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #19

Updated by Gerrit Code Review over 1 year ago

Patch set 12 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #20

Updated by Stefan Bürk over 1 year ago

  • Related to Bug #101249: Prevent exception caused by hash collisions in indexed_search added
Actions #21

Updated by Gerrit Code Review over 1 year ago

Patch set 13 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #22

Updated by Gerrit Code Review over 1 year ago

Patch set 14 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #23

Updated by Gerrit Code Review over 1 year ago

Patch set 15 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #24

Updated by Gerrit Code Review over 1 year ago

Patch set 16 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #25

Updated by Sybille Peters over 1 year ago

  • Status changed from Under Review to Closed
Actions #26

Updated by Stefan Bürk 10 months ago

  • Related to Task #102975: Use full md5 hash for `indexed_search` added
Actions #27

Updated by Gerrit Code Review 10 months ago

  • Status changed from Closed to Under Review

Patch set 17 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #28

Updated by Gerrit Code Review 10 months ago

Patch set 18 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #29

Updated by Gerrit Code Review 10 months ago

Patch set 19 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #30

Updated by Gerrit Code Review 10 months ago

Patch set 20 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #31

Updated by Gerrit Code Review 10 months ago

Patch set 21 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/74688

Actions #32

Updated by Stefan Bürk 10 months ago

  • Status changed from Under Review to Resolved
Actions #33

Updated by Benni Mack 5 months ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF