Magento 2 – Update product attributes is queued but not executed

Another annoying problem from Magento 2 – the queue for executing tasks like Product exports or the very simple updating of product attributes for several products at once (“Batch”).

The process is very simple: You want to change one or more product attributes for several products. As with Magento 1 To do this, click on the desired products in the product overview and select “Update Attributes” or. “Update Attributes” from the dropdown. Then you choose the attributes, that one wants to change and changes the value.

Now after clicking on Save you should be used to it- the corresponding attribute must be revised for the selected products.

But not so with Magento 2. Magento 2 adds this task to the queue to a time-controlled processing list. This should then be carried out by the cronjob / the cron jobs are processed, so that the tasks are completed in a timely manner.

But for us it was also in Magento 2.4.2 continue like this, that the desired changes were not made and the attributes of the products remained unchanged. This again required a lot of time and nerves for the research, but in the end there was at least a functional result. And this is this:

  1. Managed by console (SSH) once this command in the root directory of Magento “ps aufx | grep cron” – the current cron tasks are displayed. Here we established, that the jobs were there but not carried out.
  2. Magento 2 prevented by so-called. “locks” the multiple execution of a job. These locks are stored in the database by default. Here we found information, who reported problems, when the DB is used and so we tried to change the storage location to the file directory, to counteract the problem of non-execution.
  3. You can see where the locks are stored, if you look into the app / etc / env.php. There are approx. in line 51 a reference “‘provider’ => ‘db’,
  4. You can probably intervene manually at this point and change this paragraph:
    'lock' => [
        'provider' => 'file',
        'config' => [
            'path' => 'var/locks'
        ]
    ],

But we did it with this command in the console:

bin/magento setup:config:set --lock-provider="file" --lock-file-path="var/locks"

(Possibly. you still have to create the directory)
5. After that was done, ran the cron again manually

bin/magento cron:run

There were now a few in the / var / locks / directory (empty) Files, which represent the lock files.

And lo and behold – the product updates had all been carried out.

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

One comment on “Magento 2 – Update product attributes is queued but not executed”

Leave a Reply to Vikas Singh

Your email address will not be published. Required fields are marked *