Here's a way to reproduce this which is kind of silly, but is a good way to demonstrate the kind of problems that happens:

  1. edit hosting_server.drush.inc to introduce a parse error
  2. fire up a server verify task
  3. run the queue

expected result: task ends with an error

actual result: task apparently keeps running, but on the commandline you see the actual error and the task ran but crashed when changing the status.

we should have a register_shutdown_function of some sort to cleanup those conditions, maybe with a context for the task?

i have implemented a workaround in hosting-task where --force will allow hosting-task to run a task that is apparently already running, which will reset its status in the end.

CommentFileSizeAuthor
#7 hostmaster.api_.1975086-7.patch712 byteshelmo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ergonlogic’s picture

Status: Active » Postponed (maintainer needs more info)

From what I can tell, this results in a task remaining queued in the case of a parse error in Drush code. I think this is acceptable, since the error is blocking the queue from running more than resulting in an error in the actual task.

Perhaps there's another way to replicate this error?

ergonlogic’s picture

Status: Postponed (maintainer needs more info) » Active

In #2027269: warnings and errors in front-end pre- and post- hooks are ignored for task status, I removed a vbo operation for 'delete-backups' since it'll need special handling to provide it a specific backup to delete. Interestingly, it fails with a missing parameter, and results in the symptom this issue is about. I may re-introduce some of that code in order to replicate this issue conveniently.

ergonlogic’s picture

Status: Active » Needs review

I moved log parsing and status updates from #2027269: warnings and errors in front-end pre- and post- hooks are ignored for task status to separate functions and call them from a shutdown function now. It probably already fixes this issue, but I'm thinking of also implementing a button like 'retry' to allow updating the status of a stuck task. That would presumably also allow us to fix already run tasks without having to re-run them.

ergonlogic’s picture

Status: Needs review » Fixed

I tested the 'delete-backups' operation to make a task get stuck, and it doesn't appear to get stuck any longer, but rather fails as it should. I also added an 'update status' button to tasks that do still manage to get stuck in HOSTING_TASK_PROCESSING.

helmo’s picture

Status: Fixed » Needs work

The shutdown hook has a side effect....

$drush updatedb
register_shutdown_function(): Invalid shutdown callback '_hosting_task_update_status' passed hosting_task.drush.inc:12 [warning]
The following updates are pending:

..........

Do you wish to run all pending updates? (y/n): n
Aborting.

I guess that the task/hosting_task.module is not loaded at this point.

ergonlogic’s picture

Status: Needs work » Fixed

Yeah, in fd6b1e9 I had wrapped the register_shutdown_function() in a function_exists() call. This fixed it for me, but re-open if you see this happening anywhere else.

helmo’s picture

Status: Fixed » Needs review
FileSize
712 bytes

When you CTRL+C a running queued I get this warning:

Finished executing task.                                                                                                              [notice]
Going to sleep for 2 seconds after completing task.                                                                                   [notice]


^CWD hosting_queued: Received signal 2, waiting for children to die.                                                                    [notice]
WD hosting_queued: Stopped daemon                                                                                                     [notice]
Drush command terminated abnormally due to an unrecoverable error.                                                                 [error]
Trying to get property of non-object hosting_task.module:1302                                                                         [notice]
Updated task status to "Successful"                 

This patch fixed it.

ergonlogic’s picture

Status: Needs review » Reviewed & tested by the community

nice!

helmo’s picture

Status: Reviewed & tested by the community » Fixed

Committed as a3845f4

Status: Fixed » Closed (fixed)

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

  • Commit 21c6677 on 6.x-2.x, 7.x-3.x, dev-helmo-3.x by ergonlogic:
    Issue #1975086: Add 'update status' button to tasks.
    
  • Commit 5a4af8e on 6.x-2.x, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by anarcat:
    allow running tasks that appear to be running with --force
    
    this is a...

  • Commit 21c6677 on 6.x-2.x, 7.x-3.x, dev-helmo-3.x by ergonlogic:
    Issue #1975086: Add 'update status' button to tasks.
    
  • Commit 5a4af8e on 6.x-2.x, 7.x-3.x, dev-588728-views-integration, dev-1403208-new_roles, dev-helmo-3.x by anarcat:
    allow running tasks that appear to be running with --force
    
    this is a...