QueueWorker Error after updating to 4.1.9

Created on 2 May 2024, 7 months ago
Updated 11 September 2024, 2 months ago

Problem/Motivation

After updating to 4.1.9 we had to revert back because we had an error during deployment. I am not sure what caused it but figured I should report it here. We reverted back to 4.1.8 we have a fairly typical setup, the error occurred a few mins after the code was deployed likely after cron ran? But I'm not sure.

Steps to reproduce

Update from 4.1.8 to 4.1.9 then I think wait for cron to run and I get the following error. But not 100% sure yet how to reproduce the error.

TypeError: Drupal\simple_sitemap\Queue\QueueWorker::__construct(): Argument #2 ($state) must be of type Drupal\Core\State\StateInterface, Drupal\Core\KeyValueStore\KeyValueFactory given, called in /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\simple_sitemap\Queue\QueueWorker->__construct() (line 153 of modules/contrib/simple_sitemap/src/Queue/QueueWorker.php).
Drupal\Component\DependencyInjection\Container->createService(Array, 'simple_sitemap.queue_worker') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('simple_sitemap.queue_worker', 1) (Line: 440)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 237)
Drupal\Component\DependencyInjection\Container->createService(Array, 'simple_sitemap.generator') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('simple_sitemap.generator', 1) (Line: 440)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 237)
Drupal\Component\DependencyInjection\Container->createService(Array, 'simple_sitemap.form_helper') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('simple_sitemap.form_helper') (Line: 197)
Drupal::service('simple_sitemap.form_helper') (Line: 43)

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇺🇸United States NicholasS

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @NicholasS
  • 🇩🇪Germany gbyte Berlin

    I may be wrong but your deployment might have been at fault - state was indeed replaced by the key/value store and the error you are getting may be due to a partially old code base or some cache. Please retry the update, run `drush updb -y && drush cr` afterwards and let me know if the modules works.

  • 🇦🇺Australia dpi Perth, Australia

    If you change services, you need to reset the container.

    The typical pattern is by implementing an empty postupdate hook. For example `user_post_update_sort_permissions` / `layout_builder_operation_link_post_update_remove_destination_form_link`.

    I've hit this on a handful of projects so far, its annoying that it breaks CI requiring a manual CR beforehand. Especially if you dont have another module implementing an update that happens to do it for you.

    A postupdate should be implemented.

  • 🇩🇪Germany gbyte Berlin

    A postupdate should be implemented.

    Yeah maybe that's what we should be doing - feel free to create an MR. Alternatively adjust your deployment so it cleans the cache which has been the recommended approach since I can remember. I'm surprised your site doesn't break after every update.

    Also please open up bug reports against the dev version of the module and only support requests against the stable version.

  • 🇺🇸United States NicholasS

    Just as follow up our deployment CI is pretty typical, its an Acquia Cloud Next hook as follows and it was clearing cache after deployment. Again too this white screen of death only happened to use ~5min after deployment when our Cypress Testing was about half way through testing, and we have about 509 cypress tests that test various routes of the CMS and features.

    drush cr
    drush updb -y
    drush cim -y
    drush cr
    drush sset environment_indicator.current_release $deployed_tag
    
  • 🇺🇸United States NicholasS

    Update: So today I tried another migration again and its seemed to not be a problem, so could have just been a deployment hiccup? I guess well see if it happens to others or not to see if its an issue, and I guess worst case it can be solved with a cache clear I assume.

  • 🇦🇺Australia dpi Perth, Australia

    Once you clear the cache its solved.

    Its only disruptive for the deployments running after the upgrade.

  • Assigned to dpi
  • Merge request !93Clear container cache → (Closed) created by dpi
  • Issue was unassigned.
  • Status changed to Needs review 7 months ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    32 pass
  • Pipeline finished with Success
    7 months ago
    Total: 402s
    #164088
    • gbyte committed 47562635 on 4.x
      Issue #3444946 by dpi, NicholasS, gbyte: QueueWorker Error after...
  • Status changed to Fixed 3 months ago
  • 🇩🇪Germany gbyte Berlin

    Thanks.

  • 🇫🇮Finland vermario

    I have seen this same issue after deployment with the latest version of the module.

    Looking at the code in the commit above, it seems that there's only an empty function, is that intentional? Or did we need something like

      drupal_flush_all_caches();
    

    in there to actually clear the cache?

  • 🇦🇺Australia dpi Perth, Australia

    See 4

  • 🇫🇮Finland vermario

    oh, sorry I missed it :-)

    (strangely the problem still happened in my deployment even with that piece of code...)

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024