How can I troubleshoot failing tasks?

On the Phabricator Daemon console, I see a bunch of tasks with a high failure count. How can I troubleshoot a specific failing task? Is there a way to view the trace log for a specific task?

In my case, the failing tasks are all of type PhabricatorRepositorySvnCommitChangeParserWorker with >2,000 failures. I have read Troubleshooting Repository Imports, but that doesn’t answer my question of how to troubleshoot a specific task.

I can view relevant logs by searching the daemon logs for the task ID (from the Daemon console). For example:

./bin/phd log --limit 1000 | grep -B 10 -A 10 TASK-ID-HERE

I am still searching for a better solution. For example, can I view logs for a specific task? Can I kick off a task in the foreground (safely) and watch the console?

I’ve primarily done troubleshooting as you’ve noted, searching/grepping through logs. I don’t think there’s any way to debug a single task the way you describe. The phd tool has a debug command but that looks to be for running an entire daemon worker and not a singular task.

You can use ./bin/worker execute --id <id> [--trace] to execute a specific task in the foreground.

Note that this command executes the task exactly as the daemons would – so if the task has a side effect (like sending email), it may cause that side effect to occur each time you run it.

1 Like

For completeness:

For example, can I view logs for a specific task?

You should be able to do this with:

phabricator/ $ ./bin/phd log --id <id>
phabricator/ $ ./bin/phd log --id <id>

Seems like that is the daemon ID, not the task ID.

Oh, you’re right. “Find logs for a particular task” is noted in https://secure.phabricator.com/T13253 but not currently possible from the CLI.