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:
- edit hosting_server.drush.inc to introduce a parse error
- fire up a server verify task
- 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.
Comment | File | Size | Author |
---|---|---|---|
#7 | hostmaster.api_.1975086-7.patch | 712 bytes | helmo |
Comments
Comment #1
ergonlogicFrom 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?
Comment #2
ergonlogicIn #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.
Comment #3
ergonlogicI 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.
Comment #4
ergonlogicI 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.
Comment #5
helmo CreditAttribution: helmo commentedThe shutdown hook has a side effect....
I guess that the task/hosting_task.module is not loaded at this point.
Comment #6
ergonlogicYeah, 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.
Comment #7
helmo CreditAttribution: helmo commentedWhen you CTRL+C a running queued I get this warning:
This patch fixed it.
Comment #8
ergonlogicnice!
Comment #9
helmo CreditAttribution: helmo commentedCommitted as a3845f4