Closed djoesch closed 7 years ago
That looks like the Contao issue that has been fixed in Contao 3.5.17, are you sure you have updated the database after updating Contao?
No, I had no success by updating the database / install-tool.
Database is updated. The problem still exists.
I am not able to reproduce the issue. You can send me a private message with access details to your Contao system or otherwise I can't fix it.
I can confirm the problem as well. With the cookiebar extension enabled, Contao\Search::indexPage
will generate a fatal error (under some circumstances). I'll try to debug the issue.
Hmpf. It's a bitch to reproduce though :)
During debugging I noticed that the checksum of a page (for a tl_search
entry) could change, whenever someone without the COOKIEBAR_…
cookie visited the site. Thus I have created #22, this should alleviate that. Not sure if that would fix this issue as well.
Thanks @fritzmg for your valuable input! @djoesch can you try that fix before I release a new hotfix version?
I have released 1.1.2 version.
Unfortunately the template change alone didn't fix it. After a while the errors reappeared.
I think I found the problem now. I had the following database entries for example:
id pid url checksum
-----------------------------------------------------------------------------------
3 334 http://example.org/foo.html cc978fc61d226d8432297cf0fce0ad6b
1444 334 http://example.org/foo.html?pdf=505 f8a8cb99b33e996eaff1cc514d33f378
Both URLs have the same content. However the first entry was created with the cookiebar output, but at the time, still without <!-- indexer::stop -->
(!), the second entry was created without the cookiebar output. Hence they had different checksums.
Now if you have the COOKIEBAR_…
cookie and access http://example.org/foo.html
Contao generates the page without the cookiebar (or with the cookiebar, but with <!-- indexer::stop -->
, if you updated to 1.1.2
) and thus the checksum of this URL will be f8a8cb99b33e996eaff1cc514d33f378
. Therefore Contao executes:
$objDatabase->prepare("UPDATE tl_search %s WHERE id=?")
->set($arrSet)
->execute($objIndex->id); // 3
with checksum = f8a8cb99b33e996eaff1cc514d33f378
and pid = 334
. This leads to a Duplicate entry … for key 'checksum_pid'
since there is already an entry with checksum = f8a8cb99b33e996eaff1cc514d33f378
and pid = 334
(the one with id = 1444
).
Without the cookiebar Extension installed, this problem would never occur, since the second entry with the URL http://example.org/foo.html?pdf=505
would have never been created, since it would have the same checksum
and the URL of the first entry is more canonical.
TLDR: update the cookiebar extension to version 1.1.2
and clear the search index. This should solve the issue.
Thanks again @fritzmg :)
I'm sorry but I don't considered it solved... we updated cookiebar to 1.1.2 last Friday (on contao 3.5.19) and I was very surprised to see that the Fatal error appeared again yesterday! After clearing the search index it disappeared again... :(
I deleted cookiebar now until the problem is resolved...
Sorry, you mean that the problem appeared again after clearing the search index?
yes, but the problem is not coming from cookiebar: updated cookiebar on friday - cleared search index - no error anymore... then after 2 days it reappeared. now I deleted cookiebar... cleared search index... and the fatal error was there again!
so obviously its not coming from cookiebar... I deactivated the search function of the website, because its not used anyway, and reinstalled cookiebar. that should solve it for now.
@lizardat other Extensions can cause such problems as well. [visitors] for example, if you don't have the newest version.
Hello, when I activate the cookiebar on the site, I get this error together with the correct cookiebar output frame:
Fatal error: Uncaught exception Exception with message Query error: Duplicate entry '021e1039207401d29f019b1ab15a2c79-2' for key 'checksum_pid' (UPDATE tl_search SET tstamp=1479475939, url='https://www.......de/de/', title='......', protected='', filesize='89.34', groups=0, pid='2', language='de', text='...................................................................................................... …', checksum='021e1039207401d29f019b1ab15a2c79' WHERE id='111') thrown in system/modules/core/library/Contao/Database/Statement.php on line 295 #0 system/modules/core/library/Contao/Database/Statement.php(264): Contao\Database\Statement->query()
1 system/modules/core/library/Contao/Search.php(210): Contao\Database\Statement->execute('111')
2 system/modules/core/classes/FrontendTemplate.php(330): Contao\Search::indexPage(Array)
3 system/modules/core/classes/FrontendTemplate.php(124): Contao\FrontendTemplate->addToSearchIndex()
4 system/modules/core/pages/PageRegular.php(190): Contao\FrontendTemplate->output(true)
5 system/modules/core/controllers/FrontendIndex.php(285): Contao\PageRegular->generate(Object(Contao\PageModel), true)
6 index.php(20): Contao\FrontendIndex->run()
7 {main}