Bug #18253
closedDuplicate entry on cache_pagesection on reloading twice
0%
Description
If I reload a page in the frontend twice or two or more persons access the same page at almost the same time, an SQL error in tabe cache_pagesection is show.
That's a concurrence problem incorrectly fixed in http://bugs.typo3.org/view.php?id=4581
That's a concurrence problem is in that piece of code.
Two or more users can do the insert at same time . There aren't transactions or another way to control concurrence and then we can't assume that condition ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 0) is true when a process do the insert because another process could do the insert before.
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('cache_pagesection', 'page_id=' . intval($GLOBALS['TSFE']->id) . ' AND mpvar_hash=' . $mpvar_hash, $dbFields);
if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 0) {
$dbFields['page_id'] = intval($GLOBALS['TSFE']->id);
$dbFields['mpvar_hash'] = $mpvar_hash;
// HERE ===> two or more execs at the same time
$GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pagesection', $dbFields);
}
(issue imported from #M7591)
Files