1分钟后,Elastic Beanstalk Worker的SQS守护程序获得504网关超时 [英] Elastic Beanstalk Worker's SQS daemon getting 504 gateway timeout after 1 minute

查看:115
本文介绍了1分钟后,Elastic Beanstalk Worker的SQS守护程序获得504网关超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Elastic Beanstalk工作者,一次只能运行一个任务,而且需要花一些时间(从几分钟到希望少于30分钟),所以我在一个队列上排队我的任务. SQS.

I have an Elastic Beanstalk worker that can only run one task at a time and it takes some time to do so (from a few minutes to, hopefully, less than 30 minutes), so I'm queuing my tasks on a SQS.

在我的工作人员配置上,我有:

On my worker configuration, I have:

HTTP connections: 1
Visibility timeout: 3600
Error visibility timeout: 300

(On "Advanced")
Inactivity timeout: 1800

问题在于,似乎有1分钟的超时(在nginx上吗?),它覆盖了不活动超时",返回了504(网关超时).

The problem is that there seems to be a 1 minute timeout (on nginx?) that overrides the "Inactivity timeout", returning a 504 (Gateway timeout).

这是我在aws-sqsd.log文件中可以找到的东西:

This is what I can find on the aws-sqsd.log file:

2016-02-03T16:16:27Z init: initializing aws-sqsd 2.0 (2015-02-18)
2016-02-03T16:16:27Z start: polling https://sqs.eu-central-1.amazonaws.com/855381918026/jitt-publisher-queue
2016-02-03T16:23:36Z message: sent to %[http://localhost:80]
2016-02-03T16:24:36Z http-err: 1444d1ba-ecb5-46f8-82d6-d0bf19b91fad (1) 504 - 60.006
2016-02-03T16:28:54Z message: sent to %[http://localhost:80]
2016-02-03T16:29:54Z http-err: 1b7514d3-689a-4e8b-a569-5ef1ac32ed0c (1) 504 - 60.029
2016-02-03T16:29:54Z message: sent to %[http://localhost:80]
2016-02-03T16:29:54Z http-err: 1444d1ba-ecb5-46f8-82d6-d0bf19b91fad (2) 500 - 0.006
2016-02-03T16:33:49Z message: sent to %[http://localhost:80]
2016-02-03T16:34:49Z http-err: 3a43e80f-a8d3-46b2-b2a0-9d898ad4f2a6 (1) 504 - 60.023
2016-02-03T16:34:54Z message: sent to %[http://localhost:80]
2016-02-03T16:34:54Z http-err: 1b7514d3-689a-4e8b-a569-5ef1ac32ed0c (2) 500 - 0.004
2016-02-03T16:34:54Z message: sent to %[http://localhost:80]
2016-02-03T16:34:54Z http-err: 1444d1ba-ecb5-46f8-82d6-d0bf19b91fad (3) 500 - 0.003
2016-02-03T16:39:49Z message: sent to %[http://localhost:80]
2016-02-03T16:40:49Z http-err: 3a43e80f-a8d3-46b2-b2a0-9d898ad4f2a6 (2) 504 - 60.019

有些事情在这里是有意义的,例如从504/500到再次将任务重新发送给工作人员,每条消息需要5分钟的延迟(与错误可见性"的300秒配置相匹配超时").

Some things make sense here, like the 5 minute delay that each message takes from the time of the 504/500 until the task is re-sent to the worker once again (which matches the 300 seconds configuration for the "Error visibility timeout").

那500个代码与我当前的逻辑相符:如果仍然有东西在运行,工作人员将500扔回去,从而拒绝了任务.

Those 500 codes match my current logic: the worker rejects the task by throwing a 500 back if there's still something running.

我已经看到很多关于设置负载均衡器连接超时设置的答案,但是,由于这是一个从SQS队列中提取消息的工作人员,因此没有负载均衡器.

I have seen a lot of answers talking about setting the Load Balancer connection timeout setting, but, since this is a worker pulling messages from a SQS queue, there is no Load Balancer.

关于我应该怎么做才能覆盖那1分钟的超时设置的任何想法?

Any idea on what I should do to override that 1 minute timeout setting?

推荐答案

由于我有时间对此进行了更好的研究,所以解决方案是添加一个配置代理超时设置的ebextension:

Since I had the time to investigate this a little better, the solution is to add an ebextension that configures the proxy timeout settings:

files:
    "/etc/nginx/sites-available/elasticbeanstalk-nginx-docker-proxy-timeout.conf":
        mode: "000644"
        owner: root
        group: root
        content: |
            proxy_connect_timeout       3600;
            proxy_send_timeout          3600;
            proxy_read_timeout          3600;
            send_timeout                3600;
commands:
    "00nginx-create-proxy-timeout":
        command: "if [[ ! -h /etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker-proxy-timeout.conf ]] ; then ln -s /etc/nginx/sites-available/elasticbeanstalk-nginx-docker-proxy-timeout.conf /etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker-proxy-timeout.conf ; fi"

来源: http://cloudavail.com/2015/10/18/allowing-long-idle-timeouts-when-using-aws-elasticbeanstalk-and-docker/

这篇关于1分钟后,Elastic Beanstalk Worker的SQS守护程序获得504网关超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆