TYPO3-Solr / ext-solr

A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
GNU General Public License v3.0
137 stars 251 forks source link

[BUG] Separate FE and BE session storages cause 1484389971 Exception by calling Index*Action #1928

Closed dkd-kaehm closed 2 years ago

dkd-kaehm commented 6 years ago

*On systems with separate storages for Backend and Frontend, each call of IndexActions from Backend cause error 1484389971: Cannot update non-existing record.**

This happens because the storage for FE will be queried for a session id which is stored in BE storage and TSFE is initialized.

#1484389971: Cannot update non-existing record (More information)

TYPO3\CMS\Core\Session\Backend\Exception\SessionNotUpdatedException thrown in file
/var/www/vagrant/htdocs/typo3_src/typo3/sysext/core/Classes/Session/Backend/RedisSessionBackend.php in line 199.

20 TYPO3\CMS\Core\Session\Backend\RedisSessionBackend::update("502af1f1d8670efc6d5a275feaabbcc3", array)

/var/www/vagrant/htdocs/typo3_src/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php:
01331:         $updatedSession = $this->getSessionBackend()->update(
01332:             $this->id,
01333:             ['ses_data' => $this->user['ses_data']]
01334:         );
01335:         $this->user = array_merge($this->user ?? [], $updatedSession);

19 TYPO3\CMS\Core\Authentication\AbstractUserAuthentication::setAndSaveSessionData("extbase.flashmessages.tx_solr_searchbackend_solrindexqueue", array)

/var/www/vagrant/htdocs/typo3_src/typo3/sysext/core/Classes/Messaging/FlashMessageQueue.php:
00147:     protected function storeFlashMessagesInSession(array $flashMessages = null)
00148:     {
00149:         $this->getUserByContext()->setAndSaveSessionData($this->identifier, $flashMessages);
00150:     }
00151: 

18 TYPO3\CMS\Core\Messaging\FlashMessageQueue::storeFlashMessagesInSession(array)

/var/www/vagrant/htdocs/typo3_src/typo3/sysext/core/Classes/Messaging/FlashMessageQueue.php:
00095:         $queuedFlashMessages = $this->getFlashMessagesFromSession();
00096:         $queuedFlashMessages[] = $message;
00097:         $this->storeFlashMessagesInSession($queuedFlashMessages);
00098:     }
00099: 

17 TYPO3\CMS\Core\Messaging\FlashMessageQueue::addFlashMessageToSession(TYPO3\CMS\Core\Messaging\FlashMessage)

/var/www/vagrant/htdocs/typo3_src/typo3/sysext/core/Classes/Messaging/FlashMessageQueue.php:
00063:         }
00064:         if ($message->isSessionMessage()) {
00065:             $this->addFlashMessageToSession($message);
00066:         } else {
00067:             parent::enqueue($message);

16 TYPO3\CMS\Core\Messaging\FlashMessageQueue::enqueue(TYPO3\CMS\Core\Messaging\FlashMessage)

/var/www/vagrant/htdocs/typo3_src/typo3/sysext/extbase/Classes/Mvc/Controller/AbstractController.php:
00189:             $storeInSession
00190:         );
00191:         $this->controllerContext->getFlashMessageQueue()->enqueue($flashMessage);
00192:     }
00193: 

15 TYPO3\CMS\Extbase\Mvc\Controller\AbstractController::addFlashMessage("Indexing from the backend was finished successful.", "Manual Indexing", 0)

/var/www/vagrant/htdocs/typo3conf/ext/solr/Classes/Controller/Backend/Search/IndexQueueModuleController.php:
00257:             LocalizationUtility::translate($label, 'Solr'),
00258:             LocalizationUtility::translate('solr.backend.index_queue_module.flashmessage.index_manual', 'Solr'),
00259:             $severity
00260:         );
00261: 
.....

By monitoring redis server you'll see following:

Backend Database = 2 Frontend Database = 3

1522765214.002615 [0 127.0.0.1:35458] "SELECT" "2" #### Is just fine, Backend is choosen
1522765214.002950 [2 127.0.0.1:35458] "GET" "typo3_ses_BE_06cb28061e42f995b27765f3757a9512c20ece17_502af1f1d8670efc6d5a275feaabbcc3"
1522765214.033764 [2 127.0.0.1:35458] "GET" "typo3_ses_BE_06cb28061e42f995b27765f3757a9512c20ece17_502af1f1d8670efc6d5a275feaabbcc3"
1522765214.042164 [2 127.0.0.1:35458] "GET" "typo3_ses_BE_06cb28061e42f995b27765f3757a9512c20ece17_502af1f1d8670efc6d5a275feaabbcc3"
1522765214.042332 [2 127.0.0.1:35458] "SET" "typo3_ses_BE_06cb28061e42f995b27765f3757a9512c20ece17_502af1f1d8670efc6d5a275feaabbcc3" "{\"ses_id\":\"502af1f1d8670efc6d5a275feaabbcc3\",\"ses_iplock\":\"192.168.156.1\",\"ses_userid\":3,\"ses_tstamp\":1522765213,\"ses_data\":\"a:4:{s:26:\\\"formProtectionSessionToken\\\";s:64:\\\"bff9c34271b573c69478a97581b5bb4f28536f296822b0ed24ded7c6854c6c00\\\";s:27:\\\"core.template.flashMessages\\\";N;s:58:\\\"extbase.flashmessages.tx_solr_searchbackend_solrindexqueue\\\";N;s:31:\\\"TYPO3\\\\CMS\\\\Recordlist\\\\RecordList\\\";a:1:{s:12:\\\"search_field\\\";N;}}\"}"
...........
### Here is the trouble [3 ...... ] "GET" means use DB 3
1522765217.728359 [3 127.0.0.1:35458] "GET" "typo3_ses_BE_06cb28061e42f995b27765f3757a9512c20ece17_502af1f1d8670efc6d5a275feaabbcc3"
YKWeyer commented 5 years ago

@dkd-kaehm I experienced the same issue in a distinct context. It seems it comes from the TYPO3 core, and not from this specific extension.

The bug was reported, feel free to have a look at it :slightly_smiling_face:

dkd-kaehm commented 2 years ago

@YKWeyer Thanks.