aws / apprunner-roadmap

This is the public roadmap for AWS App Runner.
https://aws.amazon.com/apprunner/
Other
292 stars 13 forks source link

AWS AppRunner start command running multiple time #150

Open myanees284 opened 1 year ago

myanees284 commented 1 year ago

I am trying to run apache server on AWS AppRunner using my source code repository with corretto 11 as runtime using the below start command https://github.com/myanees284/apprunner-jmeter/blob/main/run_apacheee.sh - this script installs the apache server and starts it on default port 80

I could see the commands in the above sh gets executed and service gets deployed successfully as running. However after the deployment and health check, the commands are executed repeatedly.

Application log is here: https://gist.github.com/myanees284/db233e7e0d71eba4643f56c2e1bf87ec#file-application-logs2022-08-22t06_29_55-322z-2022-08-23t06_29_55-322z-json-L281

I am unable to understand why the code is executed multiple times when the service is already running?

msetegn commented 1 year ago

I had been experiencing something similar -- I'm hosting an API using my docker image based in ECR as the source. I have my instance setup to update the current running image whenever a new tag has been pushed.

Recently, I noticed that my database was getting 'Too many connections` errors and noticed all of the connections were coming from AWS/App Runner.

I tried killing those "ghost" App Runner connections to my database manually (connected to my database and ran kill commands to terminate the connections), but they would eventually be re-established. I think that this behavior (at least for me) occurred after multiple updates to my image source had been published. I suspect that App Runner does not properly dispose of the previous code instance.

Not 100% sure if this is relevant, but thought I'd make a note somewhere.

amitgupta85 commented 1 year ago

Hi myanees284@, I wanted to check on few things.

We don't have access to apprunner-jmeter repository, so we cannot check the run_apacheee.sh file. Could you share more about how are you installing and running apache server on AWS App Runner? Every deployment creates a new App Runner instance and if this command runs on every instance launch, you will see the logs again but for the new instance. This is expected. Which logs are you checking to know start command is running multiple times? Are these logs present in different log streams within the application log group? We create a new log stream for each new instance. If that is the case, it would explain why you see the apache server startup command multiple times - every time in the new stream that we create for a new instance.