amazon-ecs-agent icon indicating copy to clipboard operation
amazon-ecs-agent copied to clipboard

Error getting message from ws backend module="ws client" err="unexpected EOF"

Open ChrisRut opened this issue 10 years ago • 19 comments

I am getting a rather large number of these errors from my ECS agents:

[INFO] Creating poll dialer module="ws client" host="ecs-t-2.us-east-1.amazonaws.com"
[INFO] Error from tcs; backing off module="tcs handler" err="unexpected EOF"
[ERROR] Error getting message from ws backend module="ws client" err="unexpected EOF"

Why is the second entry INFO and the third is ERROR?

Over the past roughly 20hrs I've seen 132 events across an infrastructure that consist of 43 EC2 instances, all running the latest ECS optimized AMI (ami-6ff4bd05). A single entry appears to surface on each ECS agent roughly every 4-5 hours.

ChrisRut avatar Jan 07 '16 15:01 ChrisRut

Hi @ChrisRut,

Is there any way you can capture debug logs around this (ECS_LOGLEVEL=debug)? It'd also be useful to see the timestamps when this is happening.

Thanks, Sam

samuelkarp avatar Jan 07 '16 17:01 samuelkarp

Also, could you please check if you have observed missing metrics or decrease in sample counts for cluster/service utilization metrics when this happens?

Thanks, Anirudh

aaithal avatar Jan 07 '16 18:01 aaithal

@samuelkarp,

Certainly, here is 1 example:

2016-01-08T14:55:56Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:55:56Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:55:56Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"fe82f216-7cc5-4850-952c-80a02f24e88a"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.7301322221755981,"min":0.40110358595848083,"sampleCount":38,"sum":19.132459491491318},"memoryStatsSet":{"max":201,"min":200,"sampleCount":39,"sum":7802}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264956}}"
2016-01-08T14:55:36Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:55:36Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:55:36Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"f45ea7d7-9d72-4546-8b88-048e39bc5e3c"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.7626693248748779,"min":0.38328397274017334,"sampleCount":39,"sum":20.170121729373932},"memoryStatsSet":{"max":200,"min":200,"sampleCount":40,"sum":8000}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264936}}"
2016-01-08T14:55:20Z [DEBUG] ACS activity occured module="acs handler"
2016-01-08T14:55:20Z [DEBUG] Got a message from websocket module="ws client" message="{"type":"HeartbeatMessage","message":{"healthy":true}}"
2016-01-08T14:55:16Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:55:16Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:55:16Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"0db87fa8-7489-48ec-9a2f-b6e0f59b6262"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.6812929511070251,"min":0.2645682394504547,"sampleCount":39,"sum":19.18065756559372},"memoryStatsSet":{"max":200,"min":200,"sampleCount":40,"sum":8000}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264916}}"
2016-01-08T14:54:56Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:54:56Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:54:56Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"096c4566-5aea-43c2-adbe-3fae095be21b"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":1.0800857543945312,"min":0.2743759751319885,"sampleCount":39,"sum":18.908665746450424},"memoryStatsSet":{"max":201,"min":200,"sampleCount":40,"sum":8014}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264896}}"
2016-01-08T14:54:36Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:54:36Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:54:36Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"899b1b9d-2fb8-483f-bc12-efd188919994"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.6600908637046814,"min":0.3622583746910095,"sampleCount":39,"sum":19.96283522248268},"memoryStatsSet":{"max":201,"min":201,"sampleCount":40,"sum":8040}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264876}}"
2016-01-08T14:54:20Z [DEBUG] ACS activity occured module="acs handler"
2016-01-08T14:54:20Z [DEBUG] Got a message from websocket module="ws client" message="{"type":"HeartbeatMessage","message":{"healthy":true}}"
2016-01-08T14:54:16Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:54:16Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:54:16Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"64336f85-2ca8-4bd0-862d-4398a538d391"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.3561094105243683,"min":0.3561094105243683,"sampleCount":1,"sum":0.3561094105243683},"memoryStatsSet":{"max":201,"min":201,"sampleCount":2,"sum":402}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264856}}"
2016-01-08T14:54:16Z [DEBUG] Starting websocket poll loop module="tcs client"
2016-01-08T14:54:16Z [INFO] Creating poll dialer module="ws client" host="ecs-t-2.us-east-1.amazonaws.com"
2016-01-08T14:54:16Z [DEBUG] Connecting to TCS endpoint https://ecs-t-2.us-east-1.amazonaws.com/ module="tcs handler"
2016-01-08T14:54:15Z [INFO] Error from tcs; backing off module="tcs handler" err="unexpected EOF"
2016-01-08T14:54:15Z [ERROR] Error getting message from ws backend module="ws client" err="unexpected EOF"
2016-01-08T14:54:15Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"aee6a704-eb58-4b61-89f4-67b19cacd8dc"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.6361932158470154,"min":0.18999232351779938,"sampleCount":39,"sum":12.946067929267883},"memoryStatsSet":{"max":201,"min":201,"sampleCount":40,"sum":8040}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264855}}"
2016-01-08T14:53:55Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:53:55Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:53:55Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"baf80f50-4fb8-4636-bd5f-2dde45bde66d"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.7084060311317444,"min":0.2551253139972687,"sampleCount":39,"sum":18.443011462688446},"memoryStatsSet":{"max":201,"min":200,"sampleCount":40,"sum":8037}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264835}}"
2016-01-08T14:53:35Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:53:35Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:53:35Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"5ae9e57b-b06b-451d-93f2-252071d9c398"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.7586730122566223,"min":0.31386804580688477,"sampleCount":39,"sum":19.538007497787476},"memoryStatsSet":{"max":201,"min":200,"sampleCount":40,"sum":8005}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264815}}"
2016-01-08T14:53:20Z [DEBUG] Starting websocket poll loop module="acs client"
2016-01-08T14:53:20Z [INFO] Creating poll dialer module="ws client" host="ecs-a-2.us-east-1.amazonaws.com"
2016-01-08T14:53:20Z [DEBUG] Added update handlers module="updater"
2016-01-08T14:53:20Z [DEBUG] Connecting to ACS endpoint https://ecs-a-2.us-east-1.amazonaws.com/ module="acs handler"
2016-01-08T14:53:15Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-08T14:53:15Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-08T14:53:15Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/c17a3094-eabd-4eb2-ab21-6a4d02108494","fin":true,"idle":false,"messageId":"5ee9322a-321d-40fe-af81-7f690ef6d179"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.7113261818885803,"min":0.35627317428588867,"sampleCount":39,"sum":20.119364827871323},"memoryStatsSet":{"max":200,"min":200,"sampleCount":40,"sum":8000}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/e1f04249-accf-4633-9492-10aba4de0786","taskDefinitionFamily":"example-task-definition-family-1T2LI1UY2X7QQ","taskDefinitionVersion":"1"}],"timestamp":1452264795}}"

Please note I have changed the name of the cluster and taskDefinitionFamily, to example-cluster and example-task-definition-family respectively. The rest of the log data was left unaltered.

This sample is a 3 minute window around the time of the ERROR, let me know if you'd like me to expand this out further?

@aaithal , I took a look at the detailed graphs in CloudWatch, and I did NOT notice a gap in metrics during this incident, but as you can see from the log entries it does look like there was a drop in sampleCount around the time of the error.

Thank you for looking into this, -Chris

ChrisRut avatar Jan 08 '16 15:01 ChrisRut

@samuelkarp & @aaithal , Please let me know if there is any additional information I can provide in order to have the "more info needed" label removed from this issue?

ChrisRut avatar Jan 12 '16 21:01 ChrisRut

I've removed the label for now, but I haven't had a chance to start looking at it in more detail yet.

samuelkarp avatar Jan 12 '16 21:01 samuelkarp

After upgrading to the latest ECS optimized AMI (2015.09.d), we are still getting these errors, this time however with a slightly different output:

2016-01-18T15:19:02Z [ERROR] Error getting message from ws backend module="ws client" err="websocket: close 1008 InvalidContent : Unexpected text frame received"

Here it is again with 3 minutes of context:

2016-01-18T15:20:43Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:20:43Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:20:43Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"3b793a2e-2721-4f39-a20e-52cd2bf3dd15"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":1.9396312236785889,"min":0.028635669499635696,"sampleCount":39,"sum":4.48834422044456},"memoryStatsSet":{"max":105,"min":101,"sampleCount":40,"sum":4064}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130443}}"
2016-01-18T15:20:36Z [DEBUG] ACS activity occured module="acs handler"
2016-01-18T15:20:36Z [DEBUG] Got a message from websocket module="ws client" message="{"type":"HeartbeatMessage","message":{"healthy":true}}"
2016-01-18T15:20:23Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:20:23Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:20:23Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"4700c7f8-d337-4358-ac67-598d73adfc8c"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.4685377776622772,"min":0.027914347127079964,"sampleCount":39,"sum":2.512175401672721},"memoryStatsSet":{"max":101,"min":101,"sampleCount":40,"sum":4040}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130423}}"
2016-01-18T15:20:03Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:20:03Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:20:03Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"0e7e4538-5962-4789-8fb8-9396f136351b"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.385221928358078,"min":0.024038612842559814,"sampleCount":39,"sum":2.6413722410798073},"memoryStatsSet":{"max":101,"min":101,"sampleCount":40,"sum":4040}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130403}}"
2016-01-18T15:19:43Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:19:43Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:19:43Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"9b4d1984-26f0-44f2-8326-7e6ed771bdbb"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.3344128429889679,"min":0.02564769983291626,"sampleCount":39,"sum":2.271032130345702},"memoryStatsSet":{"max":101,"min":101,"sampleCount":40,"sum":4040}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130383}}"
2016-01-18T15:19:36Z [DEBUG] ACS activity occured module="acs handler"
2016-01-18T15:19:36Z [DEBUG] Got a message from websocket module="ws client" message="{"type":"HeartbeatMessage","message":{"healthy":true}}"
2016-01-18T15:19:23Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:19:23Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:19:23Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"573a29c7-45cc-441b-8875-d16a2e6c09e1"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":1.309451937675476,"min":0.020061947405338287,"sampleCount":39,"sum":3.936312759295106},"memoryStatsSet":{"max":101,"min":100,"sampleCount":40,"sum":4032}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130363}}"
2016-01-18T15:19:03Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:19:03Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:19:03Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"0119bcbc-8537-478b-8467-8edbb5ed6ed3"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.46928125619888306,"min":0.028482545167207718,"sampleCount":12,"sum":1.2528449073433876},"memoryStatsSet":{"max":101,"min":100,"sampleCount":13,"sum":1302}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130343}}"
2016-01-18T15:19:03Z [DEBUG] Starting websocket poll loop module="tcs client"
2016-01-18T15:19:03Z [INFO] Creating poll dialer module="ws client" host="ecs-t-2.us-east-1.amazonaws.com"
2016-01-18T15:19:03Z [DEBUG] Connecting to TCS endpoint https://ecs-t-2.us-east-1.amazonaws.com/ module="tcs handler"
2016-01-18T15:19:02Z [INFO] Error from tcs; backing off module="tcs handler" err="websocket: close 1008 InvalidContent : Unexpected text frame received"
2016-01-18T15:19:02Z [ERROR] Error getting message from ws backend module="ws client" err="websocket: close 1008 InvalidContent : Unexpected text frame received"
2016-01-18T15:18:57Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:18:57Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:18:57Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"6d6b2397-8fac-4ab5-8858-d05181bdb8d6"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.2946424186229706,"min":0.02241314947605133,"sampleCount":39,"sum":2.6376833003014326},"memoryStatsSet":{"max":101,"min":101,"sampleCount":40,"sum":4040}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130337}}"
2016-01-18T15:18:37Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:18:37Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:18:37Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"9a708595-ab3c-47ca-82a8-ad6382a3fa76"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.4151063859462738,"min":0.02684311755001545,"sampleCount":39,"sum":3.408000934869051},"memoryStatsSet":{"max":101,"min":100,"sampleCount":40,"sum":4015}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130317}}"
2016-01-18T15:18:36Z [DEBUG] ACS activity occured module="acs handler"
2016-01-18T15:18:36Z [DEBUG] Got a message from websocket module="ws client" message="{"type":"HeartbeatMessage","message":{"healthy":true}}"
2016-01-18T15:18:17Z [DEBUG] Received AckPublishMetric from tcs module="tcs handler"
2016-01-18T15:18:17Z [DEBUG] Got a message from websocket module="ws client" message="{"message":{},"type":"AckPublishMetric"}"
2016-01-18T15:18:17Z [DEBUG] sending payload module="tcs client" payload="{"type":"PublishMetricsRequest","message":{"metadata":{"cluster":"example-cluster","containerInstance":"arn:aws:ecs:us-east-1:628577116738:container-instance/38149998-b26e-4ba2-b8ec-b08e8d849ea5","fin":true,"idle":false,"messageId":"84f07a5a-30e6-41d5-92ff-9ec3d0e319b2"},"taskMetrics":[{"containerMetrics":[{"cpuStatsSet":{"max":0.6882961392402649,"min":0.021956773474812508,"sampleCount":38,"sum":3.5711246114224195},"memoryStatsSet":{"max":101,"min":100,"sampleCount":39,"sum":3924}}],"taskArn":"arn:aws:ecs:us-east-1:628577116738:task/4bbb0be8-f2a2-4ed3-848b-5f6b2c8bf07b","taskDefinitionFamily":"example-task-definition-family-196E6RRFZHB5F","taskDefinitionVersion":"1"}],"timestamp":1453130297}}"

To be clear, we are still also seeing the err="unexpected EOF" flavor of this error and the latest AMI, just thought you'd like to see the debug logs for the err="websocket: close 1008 InvalidContent : Unexpected text frame received" flavor.

Please let me know if there is any additional information needed, or if there are any tests you'd like me to run.

ChrisRut avatar Jan 18 '16 17:01 ChrisRut

Thank you for providing this information. The 1008 error code indicates an issue in the ECS backend while processing the metric payload message. We will look into this and get back to you when we have an update. However, please note that the ECS Agent reconnects to the backend on errors and resends the metric message. Also, as documented here, ECS Agent collects multiple samples for processing and posting metrics for the 1-minute window, which means you should really not be seeing a drop in the quality of your metrics.

aaithal avatar Jan 18 '16 17:01 aaithal

@aaithal , do you think it would be possible for you to change this "ERROR" message to a "INFO" or "WARN" since it isn't a major error, because as you mentioned you should really not be seeing a drop in the quality of your metrics?

When Splunking our logs for "ERROR" events we have to filter this one out, which isn't the end of the world, but it seems like we shouldn't have to do that for this minor issue.

ChrisRut avatar Feb 05 '16 21:02 ChrisRut

Hello, I've started seeing this issue on the 205.09.f ami just released. In my case, deploys fail because the running containers are not fully stopped allowing new containers to be launched.

Looking at the logs, it appears the agent eventually gives up completely until the agent task is restarted. I have also enabled debug logging to hopefully obtain more details the next time this occurs.

2016-02-18T17:08:02Z [WARN] Error getting instance metrics module="tcs client" err="No task metrics to report"
2016-02-18T17:09:58Z [INFO] No handler for message type module="ws client" type="CloseMessage"
2016-02-18T17:09:58Z [ERROR] Error getting message from ws backend module="ws client" err="unexpected EOF"
2016-02-18T17:09:58Z [INFO] Error from acs; backing off module="acs handler" err="unexpected EOF"`
2016-02-18T17:09:58Z [INFO] Creating poll dialer module="ws client" host="ecs-a-2.us-east-1.amazonaws.com"
2016-02-18T17:17:35Z [WARN] ACS Connection hasn't had any activity for too long; closing connection module="acs handler"
2016-02-18T17:25:21Z [INFO] Saving state! module="statemanager"
2016-02-18T17:25:21Z [CRITICAL] Error saving state before final shutdown module="TerminationHandler" err="Multiple error:
    0: Timed out waiting for TaskEngine to settle"
2016-02-18T17:25:31Z [INFO] Starting Agent: Amazon ECS Agent - v1.8.0 (4341b48)

Edit, I didn't search far enough back in issues either, as my problem also looks to be related to this: https://github.com/aws/amazon-ecs-agent/issues/250

tschutte avatar Feb 18 '16 17:02 tschutte

I'm getting the same thing as @tschutte, with deployments failing because of tasks not properly stopping.

I can't even stop the task in the console - it says it successfully has stopped it, but it still shows as running in the 'stopped' category of tasks...

When I log into the ECS instance and kill off the container, it still show as 'RUNNING (Scaling activity initiated by (deployment ecs-svc/9223370580337286137))' in the console

2016-02-26T23:04:17Z [INFO] Redundant container state change for task app-dev:7 arn:aws:ecs:eu-central-1:162137841831:task/12d6095e-94a1-4f37-8233-a27965e503c7, Status: (RUNNING->RUNNING) Containers: [app (RUNNING->RUNNING),]: app(candybanana/docker-app:latest) (RUNNING->RUNNING) to RUNNING, but already RUNNING
2016-02-26T23:08:16Z [INFO] Creating poll dialer module="ws client" host="ecs-t-1.eu-central-1.amazonaws.com"
2016-02-26T23:11:48Z [INFO] Removing container module="TaskEngine" task="app-dev:6 arn:aws:ecs:eu-central-1:162137841831:task/321a5164-6ca3-4739-8610-17c64bad1be5, Status: (STOPPED->STOPPED) Containers: [app (STOPPED->STOPPED),]" container="app(candybanana/docker-app:latest) (STOPPED->STOPPED)"
2016-02-26T23:25:47Z [INFO] Creating poll dialer module="ws client" host="ecs-a-1.eu-central-1.amazonaws.com"
2016-02-26T23:33:17Z [INFO] Creating poll dialer module="ws client" host="ecs-t-1.eu-central-1.amazonaws.com"
2016-02-26T23:49:17Z [INFO] Creating poll dialer module="ws client" host="ecs-t-1.eu-central-1.amazonaws.com"
2016-02-26T23:52:26Z [INFO] No handler for message type module="ws client" type="CloseMessage"
2016-02-26T23:52:26Z [ERROR] Error getting message from ws backend module="ws client" err="unexpected EOF"
2016-02-26T23:52:26Z [INFO] Error from acs; backing off module="acs handler" err="unexpected EOF"
2016-02-26T23:52:26Z [INFO] Creating poll dialer module="ws client" host="ecs-a-1.eu-central-1.amazonaws.com"
2016-02-26T23:54:27Z [INFO] No handler for message type module="ws client" type="CloseMessage"
2016-02-26T23:54:27Z [ERROR] Error getting message from ws backend module="ws client" err="unexpected EOF"
2016-02-26T23:54:27Z [INFO] Error from acs; backing off module="acs handler" err="unexpected EOF"
2016-02-26T23:54:27Z [INFO] Creating poll dialer module="ws client" host="ecs-a-1.eu-central-1.amazonaws.com"
2016-02-26T23:56:28Z [INFO] No handler for message type module="ws client" type="CloseMessage"
2016-02-26T23:56:28Z [ERROR] Error getting message from ws backend module="ws client" err="unexpected EOF"
2016-02-26T23:56:28Z [INFO] Error from acs; backing off module="acs handler" err="unexpected EOF"
2016-02-26T23:56:29Z [INFO] Creating poll dialer module="ws client" host="ecs-a-1.eu-central-1.amazonaws.com"
2016-02-26T23:58:30Z [INFO] No handler for message type module="ws client" type="CloseMessage"
2016-02-26T23:58:30Z [ERROR] Error getting message from ws backend module="ws client" err="unexpected EOF"
2016-02-26T23:58:30Z [INFO] Error from acs; backing off module="acs handler" err="unexpected EOF"
2016-02-26T23:58:31Z [INFO] Creating poll dialer module="ws client" host="ecs-a-1.eu-central-1.amazonaws.com"

Stacktrace after running docker kill -s USR1 ecs-agent here: https://gist.github.com/assembledadam/2ecfc04857032fde4617

assembledadam avatar Feb 27 '16 00:02 assembledadam

As of yesterday this has started impacting our deployments as well - killing the agent and letting ecs-init restart it by doing "docker kill ecs-agent" works around the issue

alexmac avatar Feb 27 '16 17:02 alexmac

@tschutte @assembledadam @alexmac , It is more likely all of the issues you guys are seeing are related to an issue with the 1.8.0 version of the ecs-agent, see: https://github.com/aws/amazon-ecs-agent/issues/313#issuecomment-187003013

And have nothing to do with the error messages that were reported for this issue:

2016-02-18T17:09:58Z [ERROR] Error getting message from ws backend module="ws client" err="unexpected EOF"

ChrisRut avatar Feb 28 '16 01:02 ChrisRut

Same problem here. Killing the ecs-agent container is the workaround.

lafraia avatar Mar 01 '16 20:03 lafraia

@lafraia , it's likely you are confusing this issue with the deadlock issue mentioned here https://github.com/aws/amazon-ecs-agent/issues/313#issuecomment-187003013

@aaithal @samuelkarp ,

I think the number of people who have confused this particular issue with other issues proves my point that this "ERROR" message shouldn't be called an ERROR as it is causing confusion, and since as @aaithal pointed out since this doesn't cause a drop in metrics (as it tries again later), can we PLEASE relabel this a WARN (or lesser) event?

ChrisRut avatar Mar 01 '16 22:03 ChrisRut

The fix in #327 has been merged into the dev branch.

juanrhenals avatar Mar 09 '16 19:03 juanrhenals

This was released with 1.8.2.

samuelkarp avatar Apr 08 '16 21:04 samuelkarp

I am seeing this issue running agent 1.9.0:

2016-05-17T20:10:44Z [ERROR] Error getting message from ws backend module="ws client" err="websocket: close 1002 Channel long idle: No message is received, close the channel"
2016-05-17T20:10:44Z [INFO] Error from tcs; backing off module="tcs handler" err="websocket: close 1002 Channel long idle: No message is received, close the channel"

Also, I am seeing no ECS metrics reported in Cloudwatch.

Is there anything I can do to help troubleshoot?

alexwen avatar May 17 '16 20:05 alexwen

I can also confirm this issue is not resolved, I am still seeing ERRORs in my logs running 1.9.0 (ECS optimized AMI 2016.03.b ami-a1fa1acc):

2016-06-28T06:31:46Z [ERROR] Error getting message from ws backend module="ws client" err="read tcp 54.219.28.201:443: connection reset by peer"
2016-06-28T05:43:28Z [ERROR] Error getting message from ws backend module="ws client" err="websocket: close 1008 InvalidContent : Unexpected text frame received"
2016-06-23T07:46:32Z [ERROR] Error getting message from ws backend module="ws client" err="websocket: close 1002 Channel long idle: No message is received, close the channel"

@samuelkarp can you please re-open this?

ChrisRut avatar Jun 28 '16 21:06 ChrisRut

@ChrisRut Those look like different errors. Can you open a new issue to track those specifically?

samuelkarp avatar Jun 28 '16 21:06 samuelkarp