title: gunicorn <HaltServer 'Worker failed to boot.' due to lack of virtual machine resource?
body: <p>I have read the posts with similar tittles and nothing seem to solve my issue. We are running a django app with gunicorn, supervisor and nginx for a few months now without any problems. This morning, out of the nowhere (I repeat out of nowhere!), I get a <code>502 bad gateway error</code> when trying to access any page of the site.</p>
  <p>after looking into it, I found that gunicorn was at fault, as shown in this gunicorn.err.log</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 209, in run
      self.sleep()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 357, in sleep
      ready = select.select([self.PIPE[0]], [], [], 1.0)
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 242, in handle_chld
      self.reap_workers()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 525, in reap_workers
      raise HaltServer(reason, self.WORKER_BOOT_ERROR)
  gunicorn.errors.HaltServer: &lt;HaltServer 'Worker failed to boot.' 3&gt;
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File &quot;/home/ubuntu/exo/bin/gunicorn&quot;, line 11, in &lt;module&gt;
      sys.exit(run())
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py&quot;, line 58, in run
      WSGIApplication(&quot;%(prog)s [OPTIONS] [APP_MODULE]&quot;).run()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/app/base.py&quot;, line 228, in run
      super().run()
   File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/app/base.py&quot;, line 72, in run
      Arbiter(self).run()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 229, in run
      self.halt(reason=inst.reason, exit_status=inst.exit_status)
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 342, in halt
      self.stop()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 393, in stop
      time.sleep(0.1)
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 242, in handle_chld
      self.reap_workers()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 525, in reap_workers
      raise HaltServer(reason, self.WORKER_BOOT_ERROR)
  gunicorn.errors.HaltServer: &lt;HaltServer 'Worker failed to boot.' 3&gt;
  </code></pre>
  <p>I am capable of understanding what is the source of the error according to this log. Any help would be hugely appreciated before I get fired!</p>
  <p>after trying to run gunicorn with <code>--debug-log debug</code> command, I get additional traceback:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/arbiter.py&quot;, line 583, in spawn_worker
      worker.init_process()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/workers/ggevent.py&quot;, line 162, in init_process
      super().init_process()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/workers/base.py&quot;, line 119, in init_process
      self.load_wsgi()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/workers/base.py&quot;, line 144, in load_wsgi
      self.wsgi = self.app.wsgi()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/app/base.py&quot;, line 67, in wsgi
      self.callable = self.load()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py&quot;, line 49, in load
      return self.load_wsgiapp()
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py&quot;, line 39, in load_wsgiapp
      return util.import_app(self.app_uri)
    File &quot;/home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/util.py&quot;, line 358, in import_app
      mod = importlib.import_module(module)
    File &quot;/usr/lib/python3.6/importlib/__init__.py&quot;, line 126, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 994, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 971, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 941, in _find_and_load_unlocked
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 994, in _gcd_import
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 971, in _find_and_load
    File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 953, in _find_and_load_unlocked
  ModuleNotFoundError: No module named 'inventory4'
  </code></pre>
  <p>Inventory4 is my django directory with the settings.py and wsgi.py</p>
  <p>this is super strange because I have not made any modification to my project configuration.</p>
  <p>here is what it looks like in django:
  settings.py:</p>
  <pre><code>WSGI_APPLICATION = 'inventory4.wsgi.application'
  </code></pre>
  <p>and wsgi.py</p>
  <pre><code>os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'inventory4.settings')
  
  application = get_wsgi_application()
  </code></pre>
  <p>and then in /etc/supervisor/conf.d/gunicorn.conf:</p>
  <pre><code>directory=/home/ubuntu/exostocksaas
  command=/home/ubuntu/exo/bin/gunicorn  --config /home/ubuntu/exo/lib/python3.6/site-packages/gunicorn/config.py --log-level debug --bind unix:/home/ubuntu/exostocksaas/app.sock inventory4.wsgi:application
  
  autostart=true
  autorestart=true
  stderr_logfile=/var/log/gunicorn/gunicorn.err.log
  stdout_logfile=/var/log/gunicorn/gunicorn.out.log
  
  
  [group:guni]
  programs:gunicorn
  </code></pre>
  <p>I have no clue what could have caused the bug to occur and how to solve it</p>