Batch icon indicating copy to clipboard operation
Batch copied to clipboard

All the tasks in pool failed with CommandLaunchFailed after a while

Open hieuhc opened this issue 7 years ago • 12 comments

Problem Description

We have a pool of one low priority Standard_NC6 as base vm which hosts a few long running tasks. After a while all the tasks on this pool failed with CommandLaunchFailed error, after retrying 1600 times (we use Azure batch-shipyard tool to specify the task with max_task_retries being -1). Command line to launch is something like this:

/bin/bash -c 'set -e; set -o pipefail; pushd /mnt/batch/tasks/startup/wd; ./registry_login.sh; popd; [ -f .shipyard.envlist ] && export $(cat .shipyard.envlist | xargs); env | grep AZ_BATCH_ >> .shipyard.envlist; nvidia-docker run --rm --name task-00001 -v $AZ_BATCH_NODE_ROOT_DIR:$AZ_BATCH_NODE_ROOT_DIR -w $AZ_BATCH_TASK_WORKING_DIR --env-file .shipyard.envlist user_image_name:image_task bash -c "cd /workspace && python -m service.main.processor"; wait'

All the tasks have some code to ignore any exceptions happening at the global level inside the task, so I think maybe this is a server error.

No log or further information could be found.

Steps to Reproduce

This happens quite randomly. We experienced this twice on the same pool among a few others

Can anyone give us some leak what has possibly happened?

hieuhc avatar Apr 05 '19 08:04 hieuhc

Here is the capture of the task status. I believe 0.27s is the running duration of last try.

image

hieuhc avatar Apr 05 '19 08:04 hieuhc

I suspect we'll need node agent logs to investigate.

If using a recent version of Shipyard, can you execute:

shipyard diag logs upload --nodeid <node id where task failed> --generate-sas

It's best to create a support ticket with your account, region, pool id and with either the logs attached or the SAS URL generated. You can reference this GitHub issue in the ticket and ask support to escalate directly to PG if you can attach the logs.

cc @matthchr

alfpark avatar Apr 05 '19 15:04 alfpark

Thanks. I have created a support request with attached log and the URL generated from shipyard diag logs. FYI I also attach the agent logs here.

redacted

hieuhc avatar Apr 08 '19 07:04 hieuhc

Thanks for the logs - at first blush, there doesn't seem to be anything wrong on the compute node side. However, these logs don't seem to correspond with the timeframe of the initial issue; the logs begin at 20190408T043746.152Z.

We'll investigate further once we receive the support ticket on our end.

alfpark avatar Apr 08 '19 14:04 alfpark

If you did not include the the following information in your support request, please add it to the request or mention it here if ok to do so publicly:

  • Region, Account, Pool Id
  • Node id, if possible
  • Job id and task id
  • Approximate time of issue

alfpark avatar Apr 08 '19 15:04 alfpark

Hi, this issue happened again early morning today in the same node. Our Azure Batch account is created in South Central US region. Not sure what is the timezone of the logs. Screen Shot 2019-04-08 at 8 49 34 PM

If this was not caused by the node, then it might be from our tasks. The thing is we couldn't find any log when containers were all removed from the node. I will add additional information to my support request.

hieuhc avatar Apr 08 '19 19:04 hieuhc

@hieuhc given that the VMs have been reclaimed/deleted when the issue was reported, it's difficult to diagnose. We don't see anything currently wrong with the low priority node running. We will most likely need an active repro with the node up.

Is it possible to do the following:

  1. Set your max_task_retries to 0.
  2. Set remove_container_after_exit to false.
  3. Do not delete the VM where the task ran (or allow autoscale to reclaim the VM; ensure that there is no autoscale formula applied to the pool and the target counts are statically set).

If you observe a repro, please do the following:

  1. Run the shipyard diag logs upload command immediately.
  2. Capture any relevant stdout.txt and stderr.txt files for the failed task, if they exist, along with a screenshot as you have done above.
  3. Add an SSH user to the pool and log in.
  4. Run docker inspect on the container if the container launched (most likely it won't have gotten this far) and capture the output for diagnosis.

If at this point you can't figure out what's going wrong with your task, please provide us with the node id and the approximate time of repro. If you provide it here, the response time will be a bit faster, but you can certainly add it to the ticket. Providing the logs capture above will also be helpful in case the node gets preempted.

alfpark avatar Apr 09 '19 16:04 alfpark

Hi @alfpark, thanks for your suggestion. I didn't know that the VM has been reclaimed/deleted. I have been using the same node id to log in to this VM during the issues. Also in our auto scale formula, there is always a low priority node running as base node, like this:

taskPerNode = 4; maxNumberOfNodes = 65; num = avg($PendingTasks.GetSample(TimeInterval_Minute * 10, 5));$TargetLowPriorityNodes = 1;$TargetDedicated= min(maxNumberOfNodes , num == 0 ? 0 : num / (taskPerNode + 1) - $TargetLowPriorityNodes + 1);

I wonder if there is any case where the low priority node is reclaimed/deleted while the tasks are running? Does it get the same node id after being brought up again? What will happen to the running tasks on that node in that case, maybe they will be restarted continuously like in my case?

I will also submit a task with your suggestion settings, will provide further details if I can repro the issue. But maybe I will keep the autoscale formula as above, because this is production environment and the issue didn't happen on other pools. Thanks

hieuhc avatar Apr 10 '19 06:04 hieuhc

Low pri nodes are reclaimed if the node is preempted. Batch will goal seek and attempt to replace the preempted low pri node and the node id you observe will be the same. This is why even though the node id remains the same, the history (via node logs) is truncated. If a task is running and the node is preempted, Batch will automatically attempt to reschedule and run the task again. It's unlikely that you'd experience these continuous restarts at this level and not have a significant delay in processing time on the order of days.

We'll keep this issue open for a while longer in case you can repro and annotate the ticket as such. Thanks for your help and patience.

alfpark avatar Apr 10 '19 15:04 alfpark

Hi. The issue has happened again today. Even though I have one task with max_task_retries being 0 and remove_container_after_exit being false, there is still no container log found, neither on Azure Portal nor in the node itself with docker inspect.

I think that this node has been reclaimed/deleted and brought up again, but not sure why our tasks were not re-run. Here are two captures, one for the task with max_task_retries and another without it. I also attach here the agent logs (with diag logs upload), captured around 30 minutes after the issue.

withoutretry

retry

redacted

The pool id is gpu-vm-prod, node id is tvm-2169193117_1-20180723t071411z-p. This issue happened around April 12, 2019 5:25 -> 5:35 UTC.

hieuhc avatar Apr 12 '19 06:04 hieuhc

Your node was preempted at around 2019-04-12T05:21:35Z which aligns with your time frame provided above. This also explains the requeue count. Unfortunately the logs attached after the fact are of not much use - everything appears to be operating normally.

For the first screenshot, it looks like things worked as expected as your task exited with 125 and the system would not have retried after that. I'd advise reviewing your task/process on why it's failing.

For the second screenshot where the task completed without an exit code, can you provide the corresponding job id and task id? Additionally, if this is a CommandLaunchFailed error code, can you check the scheduling error details? There may be some more detailed error message string.

Finally, we see that you're running an old version (1.3.0.6) of the node agent - would it be possible for you to recreate your pool to get the newest version?

alfpark avatar Apr 12 '19 17:04 alfpark

Due to the lack of log information from our Azure task and we have been running an old version of node agent, I will close this issue for now. I will upgrade the pool and better organize the logging, then will reopen the issue if it happens again with more information.

Thank you for your kind support during the process.

hieuhc avatar Apr 15 '19 06:04 hieuhc