Skip to content

Admin got auto logged out when product reviews data is more than 28,000 at Marketing > All Reviews #38198

Open
@farhanramliwowshop

Description

@farhanramliwowshop

Preconditions and environment

  • Magento 2.4.4
  • My composer.json is as follows
{
    "name": "magento/project-enterprise-edition",
    "description": "eCommerce Platform for Growth (Enterprise Edition)",
    "type": "project",
    "license": [
        "proprietary"
    ],
    "config": {
        "allow-plugins": {
            "dealerdirect/phpcodesniffer-composer-installer": true,
            "laminas/laminas-dependency-plugin": true,
            "magento/*": true
        },
        "preferred-install": "dist",
        "sort-packages": true
    },
    "version": "2.4.4-p4",
    "require": {
        "magento/composer-dependency-version-audit-plugin": "~0.1",
        "magento/composer-root-update-plugin": "~2.0",
        "magento/module-bundle-sample-data": "100.4.*",
        "magento/module-catalog-rule-sample-data": "100.4.*",
        "magento/module-catalog-sample-data": "100.4.*",
        "magento/module-cms-sample-data": "100.4.*",
        "magento/module-configurable-sample-data": "100.4.*",
        "magento/module-customer-balance-sample-data": "100.4.*",
        "magento/module-customer-sample-data": "100.4.*",
        "magento/module-downloadable-sample-data": "100.4.*",
        "magento/module-gift-card-sample-data": "100.4.*",
        "magento/module-gift-registry-sample-data": "100.4.*",
        "magento/module-grouped-product-sample-data": "100.4.*",
        "magento/module-msrp-sample-data": "100.4.*",
        "magento/module-multiple-wishlist-sample-data": "100.4.*",
        "magento/module-offline-shipping-sample-data": "100.4.*",
        "magento/module-product-links-sample-data": "100.4.*",
        "magento/module-review-sample-data": "100.4.*",
        "magento/module-sales-rule-sample-data": "100.4.*",
        "magento/module-sales-sample-data": "100.4.*",
        "magento/module-swatches-sample-data": "100.4.*",
        "magento/module-target-rule-sample-data": "100.4.*",
        "magento/module-tax-sample-data": "100.4.*",
        "magento/module-theme-sample-data": "100.4.*",
        "magento/module-widget-sample-data": "100.4.*",
        "magento/module-wishlist-sample-data": "100.4.*",
        "magento/product-enterprise-edition": "2.4.4-p2",
        "magento/sample-data-media": "100.4.*",
        "mageplaza/module-smtp": "^4.7"
    },
    "autoload": {
        "exclude-from-classmap": [
            "**/dev/**",
            "**/update/**",
            "**/Test/**"
        ],
        "files": [
            "app/etc/NonComposerComponentRegistration.php"
        ],
        "psr-0": {
            "": [
                "app/code/",
                "generated/code/"
            ]
        },
        "psr-4": {
            "Magento\\": "app/code/Magento/",
            "Magento\\Framework\\": "lib/internal/Magento/Framework/",
            "Magento\\Setup\\": "setup/src/Magento/Setup/"
        }
    },
    "require-dev": {
        "allure-framework/allure-phpunit": "~1.5.0",
        "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
        "friendsofphp/php-cs-fixer": "~3.3.0",
        "lusitanian/oauth": "~0.8.10",
        "magento/magento-coding-standard": "*",
        "magento/magento2-functional-testing-framework": "^3.7",
        "pdepend/pdepend": "~2.10.0",
        "phpmd/phpmd": "^2.9.1",
        "phpstan/phpstan": "~1.2.0",
        "phpunit/phpunit": "~9.5.0",
        "sebastian/phpcpd": "^6.0.3",
        "squizlabs/php_codesniffer": "~3.6.0",
        "symfony/finder": "^5.2"
    },
    "conflict": {
        "gene/bluefoot": "*"
    },
    "autoload-dev": {
        "psr-4": {
            "Magento\\PhpStan\\": "dev/tests/static/framework/Magento/PhpStan/",
            "Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/",
            "Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/",
            "Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/",
            "Magento\\Tools\\": "dev/tools/Magento/Tools/",
            "Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/"
        }
    },
    "minimum-stability": "stable",
    "prefer-stable": true,
    "repositories": [
        {
            "type": "composer",
            "url": "https://repo.magento.com/"
        }
    ],
    "extra": {
        "magento-force": "override"
    }
}
  • Insert up to 28,000 data of product review into a freshly installed magento, this issue occur on Magento2.4.4p2 and Magento2.4.4p4 not sure if other version also had same issue or not
  • To insert the dummy data, create a script file named 'add_reviews.php' into root directory
  • Insert content as below into the script file
use Magento\Framework\App\Bootstrap;
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Filesystem\Io\File;
use Magento\Review\Model\ReviewFactory;
use Magento\Review\Model\RatingFactory;
use Magento\Framework\App\ResourceConnection;
use Magento\Catalog\Model\ProductFactory;

require __DIR__ . '/app/bootstrap.php';

$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$appState = $objectManager->get('Magento\Framework\App\State');
$appState->setAreaCode('frontend');

$reviewFactory = $objectManager->get(ReviewFactory::class);
$ratingFactory = $objectManager->get(RatingFactory::class);
$productFactory = $objectManager->get(ProductFactory::class);
$resource = $objectManager->get(ResourceConnection::class);

// Get a random product ID
$productIds = $productFactory->create()->getCollection()->getAllIds();
$productId = $productIds[array_rand($productIds)];

// Get a random customer ID
$customerIds = $objectManager->create('Magento\Customer\Model\Customer')->getCollection()->getAllIds();
$customerId = $customerIds[array_rand($customerIds)];

$randValue = rand(1, 99999999999999);

// Create a random review title and detail
$randomTitle = "Review Title " . $randValue;
$randomDetail = "Review Detail " . $randValue;
$randomNickname = "Farhan " . $randValue;

// Create a review
$review = $reviewFactory->create();
$review->setEntityPkValue($productId);
$review->setStatusId(\Magento\Review\Model\Review::STATUS_APPROVED);
$review->setTitle($randomTitle);
$review->setDetail($randomDetail);
$review->setEntityId(1); // 1 corresponds to the product entity type
$review->setStoreId(1); // Replace with your store ID
$review->setStores([1]); // Replace with your store IDs

// Assign random ratings
$ratings = [
    'quality' => rand(1, 5),
    'price' => rand(1, 5),
    'value' => rand(1, 5),
];
$review->setRatings($ratings);

$review->setCustomerId($customerId);
$review->setNickname($randomNickname);
$review->save();

echo "Review added successfully.\n";
  • Run the script above through command line by entering this command in root directory php add_reviews.php
  • To create up to 28000 data run this command for i in {1..28000}; do php add_reviews.php; done

Steps to reproduce

  1. Make sure you already satisfy the precondition above to have added up to 28,000 or more product review data into your magento database
  2. Login into magento admin panel as Administrator or any other admin user that has access to Marketing > All Reviews
  3. Navigate to Marketing > All Reviews ( under User Content)
  4. After reaching the All Review page, try to navigate anywhere or refresh the page
  5. You will realize that you automatically got logged out

Expected result

Admin user should not get auto logged out and able to navigate anywhere as usual , able to edit the product review in the all review page

Actual result

Admin user get auto logged out, log is as follows

[2023-11-17T08:08:26.832487+00:00] report.WARNING: Session size of 2413109 exceeded allowed session max size of 256000. [] []

The issue from what seen is because of session overload and because of that magento auto logged out the admin user

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: FrameworkComponent: ReviewIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.4Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions