- Issue created by @vacho
- Status changed to Postponed: needs info
about 1 year ago 11:42pm 23 October 2023 - 🇭🇺Hungary djg_tram
@vacho -- That's not a solution. This merely silences the error but the worker will never be executed then, given a lease time of nothing.
- 🇭🇺Hungary djg_tram
@vacho -- Put a dpm() or similar dump into the first line of that function and check
$queue
to see which worker actually causes the problem. Then investigate that worker. I had the same problem and it turned out to be an error in the worker's dependency injection (I'm developing it right now, so it was my error in my case). If it's your code, fix it, if it someone else's, contact them for a fix. As it looks, this isn't a Drupal core issue at all -- as soon as I fixed my own code, it went back to normal.Basically, the first thing to check is whether line 206:
$worker = $this->queueManager->createInstance($queue_name);
can actually instantiate the worker at all. Note that various source sample floating around the web are erronous, if you happen to develop your own worker, be sure to take them with a huge grain of salt.
- Status changed to Needs review
12 months ago 3:59pm 3 January 2024 - 🇺🇸United States jeffam
I ran across this error while working on some malformed custom queueworker plugins that worked in Drupal 9 but not in Drupal 10.
But perhaps the larger issue is that the warning wasn't logged by Drupal. Without any logs, we didn't know about the issue for some time.
Here's a small patch that logs an error when line 264 in Cron.php fails and sets $lease_time to null.
This can happen if $worker->getPluginDefinition() fails (as it did in my case) or if the 'time' key is missing from the plugin definition.
- Status changed to Needs work
12 months ago 4:24pm 3 January 2024 - 🇺🇸United States smustgrave
Steps should be added to the issue summary, as well as missing sections.
Changed to 11.x as the current development branch.
Also as a bug will need a test case.
- 🇫🇷France zorax Monoblet
I ran into this problem after updating drupal to 10.2.
The patch give me "Missing lease time for cron" in my log.
I created a queue mail function from a sample floating around the web few years ago.
Can you give me an example, link to a custom queueworker plugins which is well configured for 10.2? - last update
12 months ago Custom Commands Failed - 🇫🇷France zorax Monoblet
I fixed my problem by reconfiguring the Custom Queue Worker with this example :
https://www.alansaunders.co.uk/blog/queues-drupal-8-and-9 - 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
@zorax: What did you actually change about your queue config?
@zorax Any information please? I hae the same error after upgrading drupal 9 to 10
- 🇺🇸United States a-fro
@liam-morland this was the same issue with the QueueWorkerPlugin we were using.
- 🇵🇰Pakistan usmanjutt84 Islamabad
I had my own custom queue and I was also facing the same error after upgrading Drupal
9.5
to10.3
. I followed the comment#11 🐛 At time to run cron: Trying to access array offset on value of type null in web/core/lib/Drupal/Core/Cron.php Active , it fixes the error.In my case
$worker->getPluginDefinition()
didn't return any array with the sub-array "cron" because it was empty.