I have an existing cron job defined in an annotation, with ultimate cron installed.

After I did some refactoring, got rid of the old class, and moved the annotation to a new class, cron fails with a WSOD that implicates ultimatecron.

Is this specific to ultimatecron?
Is there a preferred way to refactor a cron job? Am I missing a step here?
I have cleared caches, clicked on "discover cron jobs", disabled and re-enabled the cron job and the symptoms remain.

Here's the error:
Drupal\Component\Plugin\Exception\PluginException: Plugin (cron_salesforce_pull) instance class "Drupal\salesforce_pull\Plugin\QueueWorker\CronPull" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of /code/web/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

And the relevant part of the stack trace:

#0 /code/web/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(17): Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass()
#1 /code/web/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(85): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance()
#2 /code/web/core/lib/Drupal/Core/Queue/QueueWorkerManager.php(64): Drupal\Component\Plugin\PluginManagerBase->createInstance()
#3 /code/web/core/lib/Drupal/Core/Cron.php(146): Drupal\Core\Queue\QueueWorkerManager->createInstance()
#4 /code/web/modules/contrib/ultimate_cron/src/UltimateCron.php(70): Drupal\Core\Cron->processQueues()

Comments

aaronbauman created an issue. See original summary.

aaronbauman’s picture

Issue summary: View changes
berdir’s picture

This is a queue plugin, correct, nothing specifically integrated with ultimate_cron, right?

If I read the backtrace correctly then you are _not_ using custom queue processing, so we just hand it off to core: "#4 /code/web/modules/contrib/ultimate_cron/src/UltimateCron.php(70): Drupal\Core\Cron->processQueues(), the rest then then happens in core and should also happen in the same way when not using ultimate_cron.

No idea why you'd get this error then, \Drupal\Core\Cron::processQueues loops over defined plugins.

Are you 100% certain there isn't an error in the class namespace or so? Errors like this happen when core can discover plugins through the annotation but then fails to instantiate the plugin class because something doesn't add up.

PS: thanks for the new salesforce beta release to handle the php-jwt dependency.

aaronbauman’s picture

Status: Active » Fixed

After confirming there's no reference to this old class in the filesystem or database, i think it must have been stuck in pantheon's redis.
I cleared cache (many times), but the reference in plugin discovery cache it must have persisted.

At any rate, it's not an issue with ultimate cron so I'll close this.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.