View Issue Details

IDProjectCategoryView StatusLast Update
0006484OXID eShop (all versions)4.05. Performancepublic2017-08-01 09:42
Reportermichael_keiluweit 
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.10.1 / 5.3.1 
Target VersionFixed in Version4.10.5 / 5.3.5 
Summary0006484: oxConfig entry aServersDatais is always deleted and selected by shop id 1, but written by the actual active shop id
DescriptionThe table oxconfig holds the entry "aServerData" for every subshop. So if you have 3 shops (Id 1, 2 and 3) then there are three entries.

The boot process checks if the server information needs to recheck. This is decided by the timestamp which is stored in the array oxConfig.aServerData. The shop reads it with the method getConfigParam:

$this->_aServersData = (array) oxRegistry::getConfig()->getConfigParam('aServersData');

oxConfig will execute the init method and get the actual active shop id:
\oxConfig::init
\oxConfig::getShopId

So the config array is selected with the shop id - let's say 2. (we're in a subshop).

This entry could be outdated or empty (more in the linked bug entry). So the timestamp is null and the shop feels the urge to recheck.
After it's done it writes the information into oxConfig.aServersData. And here's the bug.
It writes always for the shop id 1. The method \oxServersManager::_save uses the method \oxConfig::saveSystemConfigParameter which gets the shop id by \oxConfig::getBaseShopId which is a string with the value 1: public function getBaseShopId() { return '1'; }

This leads to two mysql queries which are executed on each boot process for the malls:

600 Query delete from oxconfig where oxshopid = '1' and oxvarname = 'aServersData' and oxmodule = ''
600 Query insert into oxconfig (oxid, oxshopid, oxmodule, oxvarname, oxvartype, oxvarvalue)
   values('45eb6ef7e1bfcf7b08df3f0487d125c9', '1', '', 'aServersData', 'arr', ENCODE( 'a:1:{s:32:\"770d9ca56c7f12cf4f44ec9d9e93260f\";a:6:{s:2:\"id\";s:32:\"770d9ca56c7f12cf4f44ec9d9e93260f\";s:9:\"timestamp\";i:1471522486;s:2:\"ip\";s:9:\"127.0.0.1\";s:17:\"lastFrontendUsage\";i:1471522486;s:14:\"lastAdminUsage\";N;s:7:\"isValid\";b:1;}}', 'fq45QS09_fqyx09239QQ


The solution is to use the method oxConfig::getShopConfVar and giving the value 1 as shop id. I guess this is ok, as the save process of the server data use it, too. And there's no need for each sub shop to check the server as it is for the instance the same and each server has it's own entry in the array oxConfig.aServerData.

Replace:
$this->_aServersData = (array) oxRegistry::getConfig()->getConfigParam('aServersData');
by:
$this->_aServersData = (array) oxRegistry::getConfig()->getShopConfVar('aServersData', 1);
Steps To Reproduce1. install an EE (I tested with 5.3.1)
2. create a subshop without a parent shop.
3. open the mysql query log with tail -f
4. call the subshop
5. in the mysql log you will see the two queries from above for each call.
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
MySQL VersionNot defined

Relationships

related to 0006483 resolvedvilma_liorensaityte oxConfig.aServersData is for shop id !1 sometimes empty, somestimes filled 
has duplicate 0006507 closedQA MySQL Deadlock / aServersData is written on every page view 

Activities

There are no notes attached to this issue.