Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReindexAll -> getState() is not correct if the Indexer broke with PHP fatal error #11166

Closed
larsroettig opened this issue Oct 1, 2017 · 3 comments
Assignees
Labels
Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed up for grabs

Comments

@larsroettig
Copy link
Member

larsroettig commented Oct 1, 2017

If some fatal PHP error happens in the indexing process. The status is not correct reset
to StateInterface::STATUS_INVALID

Preconditions

  • Magento 2.3.0-dev

Steps to reproduce

  • Implement Indexer -> fatal error in executeFull()
  • executebin/magento indexer:reindex **your_index_name**

Expected result

  • Status is not working in Magento\Indexer\Model\Indexer line 404

Actual result

  • Status is working in Magento\Indexer\Model\Indexer line 404
@magento-engcom-team magento-engcom-team added Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Oct 1, 2017
@magento-engcom-team
Copy link
Contributor

Hi @larsroettig
Please try to describe the issue in-depth. Current description is ambiguous.
Thank you!

@larsroettig
Copy link
Member Author

larsroettig commented Oct 2, 2017

Hi, @magento-engcom-team, I update the descriptions.

I recommend changing reindexAll to :

    /**
     * Regenerate full index
     *
     * @return void
     * @throws \Exception
     */
    public function reindexAll()
    {
        if ($this->getState()->getStatus() != StateInterface::STATUS_WORKING) {
            $state = $this->getState();
            $state->setStatus(StateInterface::STATUS_WORKING);
            $state->save();
            if ($this->getView()->isEnabled()) {
                $this->getView()->suspend();
            }
            try {
                $this->getActionInstance()->executeFull();
                $state->setStatus(StateInterface::STATUS_VALID);
                $state->save();
                $this->getView()->resume();
            } catch (\Exception $exception) {
                $state->setStatus(StateInterface::STATUS_INVALID);
                $state->save();
                $this->getView()->resume();
                throw $exception;
            } catch (\Error $error) {
                $state->setStatus(StateInterface::STATUS_INVALID);
                $state->save();
                $this->getView()->resume();
                throw $error;
            }
        }
    }

@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed up for grabs feature request and removed Progress: needs update labels Oct 2, 2017
@magento-engcom-team magento-engcom-team added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed feature request labels Oct 3, 2017
okorshenko pushed a commit that referenced this issue Oct 12, 2017
 - Merge Pull Request #11183 from larsroettig/magento2:fix/11166-index-error-handling
 - Merged commits:
   1. fb2ec44
   2. 214fc33
@magento-engcom-team
Copy link
Contributor

Hi @larsroettig. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1283 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming patch release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Jan 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed up for grabs
Projects
None yet
Development

No branches or pull requests

2 participants