Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

amazon web services - ALB gives target_status_code as - (hyphen)

I have my application hosted in AWS. And I have a python application running on the ECS using gunicorn web server and the ECS is behind the load balancer (ALB). The issue that I'm facing is, I get a 502 Gateway error often from ALB. When I checked the logs, it has - (hyphen) in the place of the target_status_code column.

According to AWS doc, the following is the description for this field,

target_status_code: The status code of the response from the target. This value is recorded only if a connection was established to the target and the target sent a response. Otherwise, it is set to -.

But when I checked the target groups, it doesn't look like there are any connection issues.

I use the following command to start the gunicorn workers,

gunicorn 
-c gunicorn_config.py 
-b 0.0.0.0:5000 aiohttp_wsgi_handler:aioapp 
-k aiohttp.worker.GunicornWebWorker 
-w 3 
--access-logfile - 
--access-logformat '%t [INFO] %P request_id=%{X-REQUEST-ID}o cf_id=%{X-Amz-Cf-Id}i %r %s %b %Tfs' 
--log-level debug 
--graceful-timeout 180

Also, I checked the application logs, the request that I made hasn't reached the application.

What could be the cause for this?

question from:https://stackoverflow.com/questions/65841589/alb-gives-target-status-code-as-hyphen

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...