Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
the below actions are running successfully but its state Failure, as you can check it from (admin/config/system/queues/jobs/drd).
Failed actions:
- Run cron
- Rebuild job schedulers
- Update DRD library
- Get or set maintenance mode (turn on, turn off)
- Execute arbitrary PHP code
- Updates translations
- Execute arbitrary PHP code
- Change user credentials
Proposed resolution
I traced the issue and I found the response for all these actions is empty array, also I checked the drd agent library latest version drd-1.7.0.phar, and I can see return [];
from cron action.
I think it's better to return another response like True
or False
in case the action not need any other information instead of emty array.
Comments
Comment #2
Odai AtiehComment #3
Odai AtiehComment #5
jurgenhaasGreat report, thanks @Odai Atieh for taking the time to analyse it so deeply. To fix the issue I've taken a slightly different approach by better checking the return values where needed. So the fix in purely in DRD and if you give the latest dev release a try it should be fixed. Please let us know if it works for you this way.
Comment #6
Odai AtiehThank you @jurgenhaas
I tested the latest dev release, but the same issue still exists.
Comment #7
jurgenhaasSorry, I can't reproduce the problem any longer. Here is what I'm doing:
drush advancedqueue:queue:process drd
Can you please clarify what exactly is going wrong in your case?
Comment #8
Odai AtiehTo reproduce the issue:
Comment #9
jurgenhaasI can't confirm, this is working just fine with the latest dev release. So the failure in your case may come from a different source then?
Comment #10
Odai AtiehI think this is related to
process
function in /src/Plugin/AdvancedQueue/JobType/Action.php ,and after debugging the result array, I found it empty, so the last line will always be Failure
return new JobResult($result ? Job::STATE_SUCCESS : Job::STATE_FAILURE);
Comment #11
jurgenhaasWell, the value for $result comes from
$result = $this->processAction();
and the return code from that is gathered from \Drupal\drd\Plugin\AdvancedQueue\JobType\ActionEntity::processAction() and looks likereturn ($action->executeAction($entity) !== FALSE);
So, that can never be an empty array, it can only be TRUE or FALSE. Which is what I have introduced into the latest dev release.
Comment #12
jurgenhaasComment #13
jurgenhaashttps://gitlab.com/drupalspoons/drd/-/issues/47