title: FATAL error ocurred when uwsgi works with supervisor
body: <p>I have a website using nginx + uwsgi + flask. I use supervisor to control uwsgi.
  It works well when use <code>uwsgi uwsgi_config.ini</code></p>
  
  <p>But when using supervisor, it always give a fatal error, exited too quickly. However, the uwsgi process is still running in the background. That means my website is still running.</p>
  
  <p>The supervisor log is like this:</p>
  
  <pre><code>2017-04-28 21:22:25,771 CRIT Running without any HTTP authentication checking
  2017-04-28 21:22:25,775 INFO daemonizing the process
  2017-04-28 21:22:25,775 INFO supervisord started with pid 5246
  2017-04-28 21:22:25,776 INFO spawned: 'access_token' with pid 5248
  2017-04-28 21:22:25,778 INFO spawned: 'ggc-mp' with pid 5249
  2017-04-28 21:22:25,796 INFO exited: ggc-mp (exit status 0; not expected)
  2017-04-28 21:22:25,796 INFO received SIGCLD indicating a child quit
  2017-04-28 21:22:26,797 INFO success: access_token entered RUNNING state, process has stayed up for &gt; than 1 seconds (startsecs)
  2017-04-28 21:22:26,799 INFO spawned: 'ggc-mp' with pid 5266
  2017-04-28 21:22:26,807 INFO exited: ggc-mp (exit status 0; not expected)
  2017-04-28 21:22:26,808 INFO received SIGCLD indicating a child quit
  2017-04-28 21:22:28,811 INFO spawned: 'ggc-mp' with pid 5270
  2017-04-28 21:22:28,819 INFO exited: ggc-mp (exit status 0; not expected)
  2017-04-28 21:22:28,820 INFO received SIGCLD indicating a child quit
  2017-04-28 21:22:31,824 INFO spawned: 'ggc-mp' with pid 5273
  2017-04-28 21:22:31,833 INFO exited: ggc-mp (exit status 0; not expected)
  2017-04-28 21:22:31,834 INFO received SIGCLD indicating a child quit
  2017-04-28 21:22:32,835 INFO gave up: ggc-mp entered FATAL state, too many start retries too quickly
  </code></pre>
  
  <p>And here is the config file for supervisor:</p>
  
  <pre><code>[program:ggc-mp]
  command=/home/www/bin/uwsgi /home/www/uwsgi_config.ini
  directory=/home/www/ggc-mp
  user=root
  autostart=true
  autorestart=true
  stdout_logfile=/home/www/logs/uwsgi_supervisor.log
  stderr_logfile=/home/www/logs/uwsgi_supervisor_err.log
  priority=80
  </code></pre>
  
  <p>And for uwsgi, the config is as follows:</p>
  
  <pre><code>[uwsgi]
  socket = 127.0.0.1:8001
  chdir = /home/www/ggc-mp
  wsgi-file = run.py 
  callable = app 
  processes = 1
  enable-threads = true
  stats = 127.0.0.1:9191
  master = 1
  no-orphans = true
  daemonize = /home/www/logs/uwsgi.log
  </code></pre>
  
  <p>Logs for uwsgi:</p>
  
  <pre><code>*** Starting uWSGI 2.0.15 (64bit) on [Fri Apr 28 21:22:25 2017] ***
  compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-18) on 27 April 2017 01:21:21
  os: Linux-2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014
  nodename: iZ944btl9ixZ
  machine: x86_64
  clock source: unix
  detected number of CPU cores: 1
  current working directory: /
  detected binary path: /home/www/bin/uwsgi
  !!! no internal routing support, rebuild with pcre support !!!
  uWSGI running as root, you can use --uid/--gid/--chroot options
  *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
  chdir() to /home/www/ggc-mp
  your processes number limit is 7798
  your memory page size is 4096 bytes
  detected max file descriptor number: 65535
  lock engine: pthread robust mutexes
  thunder lock: disabled (you can enable it with --thunder-lock)
  uwsgi socket 0 bound to TCP address 127.0.0.1:8001 fd 3
  Python version: 3.6.1 (default, Apr 26 2017, 23:51:23)  [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]
  Python main interpreter initialized at 0x243d8b0
  python threads support enabled
  your server socket listen backlog is limited to 100 connections
  your mercy for graceful operations on workers is 60 seconds
  mapped 145536 bytes (142 KB) for 1 cores
  *** Operational MODE: single process ***
  *** Starting uWSGI 2.0.15 (64bit) on [Fri Apr 28 21:22:26 2017] ***
  compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-18) on 27 April 2017 01:21:21
  os: Linux-2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014
  nodename: iZ944btl9ixZ
  machine: x86_64
  clock source: unix
  detected number of CPU cores: 1
  current working directory: /
  detected binary path: /home/www/bin/uwsgi
  !!! no internal routing support, rebuild with pcre support !!!
  uWSGI running as root, you can use --uid/--gid/--chroot options
  *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
  chdir() to /home/www/ggc-mp
  your processes number limit is 7798
  your memory page size is 4096 bytes
  detected max file descriptor number: 65535
  lock engine: pthread robust mutexes
  thunder lock: disabled (you can enable it with --thunder-lock)
  probably another instance of uWSGI is running on the same address (127.0.0.1:8001).
  bind(): Address already in use [core/socket.c line 769]
  WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x243d8b0 pid: 5251 (default app)
  *** uWSGI is running in multiple interpreter mode ***
  spawned uWSGI master process (pid: 5251)
  spawned uWSGI worker 1 (pid: 5269, cores: 1)
  *** Stats server enabled on 127.0.0.1:9191 fd: 12 ***
  /home/www/lib/python3.6/site-packages/pymongo/topology.py:145: UserWarning: MongoClient opened before fork. Create MongoClient with connect=False, or create client after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#pymongo-fork-safe&gt;
    "MongoClient opened before fork. Create MongoClient "
  No handler responded message &lt;werobot.messages.events.ViewEvent object at 0x7ff178c7ffd0&gt;
  [pid: 5269|app: 0|req: 1/1] 58.247.206.153 () {44 vars in 789 bytes} [Fri Apr 28 21:22:28 2017] POST /werobot/?signature=262a145e32744ff1837ef9196991b13522848a2e&amp;timestamp=1493385748&amp;nonce=669799016&amp;openid=o9nkNwnYrkS4RCUG7XgAa5NvT6mQ =&gt; generated 0 bytes in 306 msecs (HTTP/1.1 200) 3 headers in 109 bytes (1 switches on core 0)
  [pid: 5269|app: 0|req: 2/2] 125.68.14.199 () {48 vars in 1396 bytes} [Fri Apr 28 21:22:28 2017] GET /disc/ =&gt; generated 277 bytes in 2 msecs (HTTP/1.1 302) 3 headers in 150 bytes (1 switches on core 0)
  *** Starting uWSGI 2.0.15 (64bit) on [Fri Apr 28 21:22:28 2017] ***
  compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-18) on 27 April 2017 01:21:21
  os: Linux-2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014
  nodename: iZ944btl9ixZ
  machine: x86_64
  clock source: unix
  detected number of CPU cores: 1
  current working directory: /
  detected binary path: /home/www/bin/uwsgi
  !!! no internal routing support, rebuild with pcre support !!!
  uWSGI running as root, you can use --uid/--gid/--chroot options
  *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
  chdir() to /home/www/ggc-mp
  your processes number limit is 7798
  your memory page size is 4096 bytes
  detected max file descriptor number: 65535
  lock engine: pthread robust mutexes
  thunder lock: disabled (you can enable it with --thunder-lock)
  probably another instance of uWSGI is running on the same address (127.0.0.1:8001).
  bind(): Address already in use [core/socket.c line 769]
  [pid: 5269|app: 0|req: 3/3] 125.68.14.199 () {48 vars in 1454 bytes} [Fri Apr 28 21:22:28 2017] GET /disc/o9nkNwnYrkS4RCUG7XgAa5NvT6mQ/ =&gt; generated 4846 bytes in 693 msecs (HTTP/1.1 200) 2 headers in 81 bytes (1 switches on core 0)
  No handler responded message &lt;werobot.messages.events.ViewEvent object at 0x7ff178c7fe80&gt;
  [pid: 5269|app: 0|req: 4/4] 58.247.206.152 () {44 vars in 791 bytes} [Fri Apr 28 21:22:31 2017] POST /werobot/?signature=3c35ec864867a3bbd92c4280736945014a6c2209&amp;timestamp=1493385751&amp;nonce=1199266520&amp;openid=o9nkNwnYrkS4RCUG7XgAa5NvT6mQ =&gt; generated 0 bytes in 50 msecs (HTTP/1.1 200) 3 headers in 109 bytes (1 switches on core 0)
  [pid: 5269|app: 0|req: 5/5] 125.68.14.199 () {48 vars in 1398 bytes} [Fri Apr 28 21:22:31 2017] GET /order/ =&gt; generated 4746 bytes in 679 msecs (HTTP/1.1 200) 2 headers in 81 bytes (1 switches on core 0)
  *** Starting uWSGI 2.0.15 (64bit) on [Fri Apr 28 21:22:31 2017] ***
  compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-18) on 27 April 2017 01:21:21
  os: Linux-2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014
  nodename: iZ944btl9ixZ
  machine: x86_64
  clock source: unix
  detected number of CPU cores: 1
  current working directory: /
  detected binary path: /home/www/bin/uwsgi
  !!! no internal routing support, rebuild with pcre support !!!
  uWSGI running as root, you can use --uid/--gid/--chroot options
  *** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
  chdir() to /home/www/ggc-mp
  your processes number limit is 7798
  your memory page size is 4096 bytes
  detected max file descriptor number: 65535
  lock engine: pthread robust mutexes
  thunder lock: disabled (you can enable it with --thunder-lock)
  probably another instance of uWSGI is running on the same address (127.0.0.1:8001).
  bind(): Address already in use [core/socket.c line 769]
  [pid: 5269|app: 0|req: 6/6] 125.68.18.192 () {44 vars in 610 bytes} [Fri Apr 28 21:22:33 2017] GET /image/wx-share/pot.png =&gt; generated 43265 bytes in 8 msecs via sendfile() (HTTP/1.1 200) 8 headers in 288 bytes (0 switches on core 0)
  </code></pre>
  
  <p>Can anyone help?</p>