AWS Instance Deployment flask Error Script-timed-out-before-returning-headers-application-py

Source: Internet
Author: User

Source: http://www.aisir.cn/2017/07/15/aws Instance deployment flask Error script-timed-out-before-returning-headers-application-py/

[Thu Jul 13 13:21:32.542375 2017] [Core:error] [PID 25744] [Client 127.0.0.1:48852] Script timed out before returning Headers:application.py[thu Jul 13:21:32.618324] [core:error] [pid 25672] [Clien  T 127.0.0.1:48754] Script timed out before returning Headers:application.py[thu Jul 13:21:33.517055] [Core:error] [PID 25702] [Client 127.0.0.1:48846] Script timed out before returning Headers:application.py[thu Jul 13:21:33.593206] [core:error] [pid 25722] [Clien T 127.0.0.1:48814] Script timed out before returning headers:application.py

This is a problem that has been plagued by demand, the number of messages received from SQS has more than 10,000, not many, has always been the problem of flask framework, so the solution has been

Background of the production:

Grab Facebook ad data and process it through the SQS distribution in AWS, with the number of SQS in the million, while extracting the image video information from the ad data, the execution time is consumed in the network request.

Problem solving:

Configuring a Machine instance

Visibility timeout (SQS visibility timeout): 3600

Official explanation: The number of seconds that the inbound message is locked for processing before it is returned to the queue. You know, that's more than the time setting for an app to process SQS messages.

Inactivity Timeout (inactivity timeout): 1800

Official explanation: The number of seconds to wait for a response from an application on an existing connection. That is, how long to report time out error, that is, the error seen above.

Note: the inactivity timeout needs to be less than the visibility timeout, otherwise the error the inactivity timeout you specified for your worker tier environment is greater than the SQS Visibility timeout. Be aware that this can result in multiple retries, which can increase the resources your application tasks consume. Consider an inactivity timeout , that's not greater than.

The workaround for this problem on the Stack overflow is that the test is not valid in the. ebextensions Command

: Files:
"/etc/httpd/conf.d/wsgi_custom.conf":
Mode: "000644"
Owner:root
Group:root
Content: |
Wsgiapplicationgroup%{global}

AWS Instance Deployment flask Error Script-timed-out-before-returning-headers-application-py

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.