LoginSignup
12
3

More than 1 year has passed since last update.

ECS Fargate の起動エラー (StoppedReason) コレクション

Last updated at Posted at 2022-03-07

前置き

自社サービスにて大量の Fargate を起動している (1 分間に数個程度) が、稀に Fargate が起動に失敗することがある。

実にいろいろな理由で失敗するものだなと見返したいので、集めてどうするという話だがまとめてみる。

コレクション

出現のレア度によって N, SR, SR, SSR でカテゴリ分けした。

N

ResourceInitializationError: failed to configure ENI: failed to setup regular eni: context deadline exceeded

よく出る。ENI の設定に失敗ということで、同時刻に複数個の Fargate を起動させるようとすると出る?
ちなみに利用可能な IP は潤沢に余っているので、サブネットの問題ではなさそうである。

Timeout waiting for network interface provisioning to complete.

これも ENI 関連でよく見かける。同時起動に関わらず出る気がする。

R

Task failed to start

シンプルで潔い理由。出てもなんだか許せる。

ResourceInitializationError: failed to configure ENI: failed to setup regular eni: netplugin failed with no error message

これも ENI で、netplugin が失敗したとのこと。netplugin とは内部モジュールのことなのだろうか?

SR

ResourceInitializationError: unable to pull secrets or registry auth: execution resource retrieval failed: unable to retrieve secrets from ssm: service call has been retried 5 time(s): RequestCanceled: request context canceled caused by: context deadli...

SSM Parameter Store のエラーだろうか。service call を 5 回リトライしても失敗するとは、なかなか。
エラー文が長すぎて文末がどうなっているかわからないのが残念。

CannotCreateVolumeError: unable to copy contents to volume on host: containerd: unable to prepare mounts from the snapshot: unable to prepare mounts: 2 errors occurred: * context deadline exceeded * context deadline exceeded

context deadline なので、起動数に関連していそう。

CannotPullContainerError: ref pull has been retried 1 time(s): failed to read expected number of bytes: unexpected EOF

Pull の失敗も稀に生じる。unexpected EOF という状況に少し興味があるが。

ECS detected degradation of the underlying infrastructure hosting your task.

インフラ側に問題あるよ、という文字通りの内容。具体的にどのようなデグレが生じたのかやはり気になる。

SSR

Unexpected EC2 error while attempting to attach network interface to instance

Fargate ではあるが EC2 のエラー。ホスト側の問題だろうか。ほとんど見かけない。

CannotPullContainerError: ref pull has been retried 1 time(s): failed to extract layer sha256:abc123...: gzip: invalid checksum: unknown

gzip の extract でチェックサムが合わないらしい。そんなことあるのか。

所感

多くは同時起動によるスロットリングに起因しているのかなと推測される。
また、時期によってエラーの発生頻度に偏りがみられた。今は見られないエラーもちらほらあり、見えないところで Fargate の改善が進められているのかなと感じる。

Fargate を使ったワークロードがクリティカルなものである場合、後述のリトライが必須である。

備考

Fargate 起動エラーへの基本的な対策

エラーを回避するのは不可能なので、エラー発生時にリトライさせる必要がある。
自前で実装するか、Step Functions でステートマシンを組むなどの方法がある。

12
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
3