Search code examples
amazon-web-servicesnginxamazon-elastic-beanstalkamazon-linux-2

ElasticBeanstalk with Amazing Linux 2 keeps timing out even with Nginx config updates


I have a Flask app (WSGI) deployed to Elastic Beanstalk using the Amazing Linux 2. In my /var/log/web.stdout.log, I have:

Jul 13 20:47:34 ip-172-31-11-53 web: [2020-07-13 20:47:34 +0000] [1531] [INFO] Worker exiting (pid: 1531)
Jul 13 20:47:34 ip-172-31-11-53 web: Loading generator
Jul 13 20:47:34 ip-172-31-11-53 web: cache_dir /tmp/downloads/models
Jul 13 20:47:34 ip-172-31-11-53 web: using device: cpu
Jul 13 20:47:35 ip-172-31-11-53 web: [2020-07-13 20:47:35 +0000] [1576] [INFO] Booting worker with pid: 1576
Jul 13 20:47:39 ip-172-31-11-53 web: Some weights of GPT2LMHeadModel were not initialized from the model checkpoint at distilgpt2 and are newly initialized: ['transformer.h.0.attn.masked_bias', 'transformer.h.1.attn.masked_bias', 'transformer.h.2.attn.masked_bias', 'transformer.h.3.attn.masked_bias', 'transformer.h.4.attn.masked_bias', 'transformer.h.5.attn.masked_bias']
Jul 13 20:47:39 ip-172-31-11-53 web: You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
Jul 13 20:48:05 ip-172-31-11-53 web: [2020-07-13 20:48:05 +0000] [3858] [CRITICAL] WORKER TIMEOUT (pid:1576)
Jul 13 20:48:05 ip-172-31-11-53 web: [2020-07-13 20:48:05 +0000] [1576] [INFO] Worker exiting (pid: 1576)

which indicates a 20 second timeout. However, in .platform/hooks/nginx/conf.d/timeout.conf, I have:

proxy_connect_timeout 600s;
proxy_send_timeout 600s; 
proxy_read_timeout 600s; 
fastcgi_send_timeout 600s; 
fastcgi_read_timeout 600s;

This should give a 600 second timeout, but alas - does not. What am I doing wrong?


Solution

  • The timeout.conf should be in:

    .platform/nginx/conf.d/timeout.conf
    

    as documented here.

    However you have it in hooks folder:

    .platform/hooks/nginx/conf.d/timeout.conf
    

    This could explain why they are not applied. There still could be other reasons, but the wrong folder is one that is apparent at present.