lambci / docker-lambda

Docker images and test runners that replicate the live AWS Lambda environment
MIT License
5.84k stars 431 forks source link

Container exit code is 1 when there are no application errors #294

Open ravikashyap1 opened 3 years ago

ravikashyap1 commented 3 years ago

I am running .net 2.1 code which completes with no errors but the docker container exits with 1 occasionally. This happens about 1% of the time. I am running this as a Fargate task in AWS, and so don't have the docker container id to inspect. In what circumstances would docker-lambda return an exit code of 1 ?

mhart commented 3 years ago

There are a few cases that the mock bootstrap will exit with this code:

https://github.com/lambci/docker-lambda/blob/187542add179d199825090c10d6bbb387d76fea1/dotnetcore2.1/run/MockBootstraps/MockRuntime.cs#L125

https://github.com/lambci/docker-lambda/blob/187542add179d199825090c10d6bbb387d76fea1/dotnetcore2.1/run/MockBootstraps/MockRuntime.cs#L214

I'm guessing it's probably a socket timeout or similar

ravikashyap1 commented 3 years ago

Is there a workaround you recommend?

mhart commented 3 years ago

Unfortunately I've never seen it before. If you find a way of reliably reproducing it, let me know and I'll see if I can determine the root cause.

ravikashyap1 commented 3 years ago

I have not been able to repro this manually. It happens completely at random and the last occurrence was when the container ran for just under 5 seconds and without any app error, but the container exited with 1. A retry (run the container all over again, with the same payload) works.