undecipherable HostConfigError
I see the following error regularly when running hundreds of instances and containers
HostConfigError: Unable to resolve volume mounts; invalid path: karius-pipeline-1-0-1 -tmp; -> /tmp
However, these exact same task parameters get successfully run most of the time, so the error message is obviously wrong. My solution is to just retry the task.
I have seen this error definitely caused by device mapper being out of disk space, but I also see it now when there is still device mapper disk space.
My request is just to get a meaningful error message from ecs-agent
Can you provide an example task definition that seems to cause this error?
For reference, this is where the error happens. I'm assuming the container name is karius-pipeline-1-0-1, the source volume is -tmp, the source path is blank (which is how it got in this branch), and the container path is /tmp. Are you using an empty host volume here?
Yes, good assumptions. I think that any task definition that wants to mount when devicemapper is out of disk should work. Here is some copy & paste from the UI
Container Path Source Volume Read only
/root/.aws awsconfig true
/tmp -tmp
I can get you a full JSON definition tomorrow.
@gregwebs Can you provide the task definition here?
@gregwebs I'm going to close this for now. Please feel free to reopen this issue when you're able to provide the task definition causing this error.
Hi there. Sorry to revive this old thread, but I am getting the same error message. Just like @gregwebs I get this sporadically and it causes my task to fail. Most tasks with the same definition succeed.
Any ideas on what I might be doing wrong @samuelkarp ?
Error Message: HostConfigError: Unable to resolve volume mounts; invalid path: default workdir; -> /app/workdir
Task Definition:
{
"jobDefinitionName": "mtb-dcc-worker-dev-job",
"jobDefinitionArn": "arn:aws:batch:us-east-1:865329123586:job-definition/mtb-dcc-worker-dev-job:9",
"revision": 9,
"status": "ACTIVE",
"type": "container",
"parameters": {},
"containerProperties": {
"image": "865329123586.dkr.ecr.us-east-1.amazonaws.com/mtb-dcc/dcc-worker:dev",
"vcpus": 1,
"memory": 2048,
"command": [
"Ref::jobId",
"Ref::inputDir",
"Ref::outputDir"
],
"volumes": [
{
"host": {},
"name": "workdir"
},
{
"host": {},
"name": "tmp"
}
],
"environment": [],
"mountPoints": [
{
"containerPath": "/app/workdir",
"sourceVolume": "workdir"
},
{
"containerPath": "/tmp",
"sourceVolume": "tmp"
}
],
"ulimits": []
}
}
This error had been plaguing our development cluster for some time now; and is quite difficult to debug, as the error suggests there is a problem with your task definition. Occasionally we would get an error complaining of no space on device, however docker info will show considerable (~75%) free space on the dedicated 24G docker disk, as well as df showing plenty of free space (~50%, though that is still unusually quite high usage.)
For anyone else who's ran into this error: the problem is that there are no free inodes on the root disk (df --inodes). Docker images and containers are stored on the dedicated disk. However, docker volumes are stored on the root disk. In our case, we sometimes use a data volume container with volumesFrom (ironically to save inodes;) and if you're using something like nodejs, then inode usage on an 8G root disk takes a significant hit from a single instance of a service.
Normally this wouldn't really be an issue, however we also had a DNS issue occur for our own internal network. This in turn caused the services in the cluster that attempted to connect to databases on the internal network to die, as they had no route to the host. ECS responds to this by starting more tasks, which then creates more volumes on the root disk, and eventually will break the instance if the volumes aren't cleaned up quick enough. The problem is then exacerbated by the fact that any task that ECS tried to assign to that instance with volumes will then fail, despite the size of the volume it is trying to allocate.
In our case, logs aren't stored on disk anyway; so I could just set ECS_ENGINE_TASK_CLEANUP_WAIT_DURATION=1m to clean up any failed tasks and volumes immediately, the default however is 3h. This allows the cluster to function as expected - even though the tasks are then just constantly dying.
@samuelkarp it seems that when docker can't allocate the anonymous volume, hv.SourcePath() == "" which triggers the error: https://github.com/aws/amazon-ecs-agent/blob/master/agent/api/task.go#L821