title: OSError: [Errno 98] Address already in use
body: <p>I have written a simple REST API using flask web framework. It is working as expected on my local machine.</p>
  <p>I tried deploying the same to Google App Engine. When I run it, I get the following error.</p>
  <pre><code> &quot;/opt/python3.9/lib/python3.9/socketserver.py&quot;, line 475, in server_activate      self.socket.listen(self.request_queue_size)  OSError: [Errno 98] Address already in use
  </code></pre>
  <p>app.yaml</p>
  <pre><code>runtime: python39
  </code></pre>
  <p>requirements.txt</p>
  <pre><code>Flask==1.1.2
  firebase-admin==4.5.3
  pyfcm==1.5.1
  </code></pre>
  <p>main.py</p>
  <pre><code>import flask
  import firebase_admin
  import pyfcm 
  
  
  from flask import Flask, request, jsonify
  from firebase_admin import credentials, firestore, initialize_app
  from pyfcm import FCMNotification
  
  
  # Initialize Flask App
  app = flask.Flask(__name__)
  # app.config[&quot;DEBUG&quot;] = True
  
  cred = credentials.Certificate('key.json')
  default_app = initialize_app(cred)
  db = firestore.client()
  
  
  @app.route('/', methods=['GET'])
  def home():
      return &quot;&lt;h1&gt;Welcome&lt;/h1&gt;&quot;
  
  app.run()
  </code></pre>
  <p>The command <code>sudo netstat -nlp | grep 1</code> produces this output:</p>
  <pre><code>tcp        0      0 127.0.0.1:8998          0.0.0.0:*               LISTEN      -
  tcp        0      0 0.0.0.0:65001           0.0.0.0:*               LISTEN      -
  tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      117/sshd
  </code></pre>
  <p>Are these valid listeners? How can I find out what these processes are about?</p>
  <p>Trace is as follows.</p>
  <pre><code>File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/arbiter.py&quot;, line 583, in spawn_worker
        worker.init_process()
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/workers/gthread.py&quot;, line 92, in init_process
        super().init_process()
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/workers/base.py&quot;, line 119, in init_process
        self.load_wsgi()
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/workers/base.py&quot;, line 144, in load_wsgi
        self.wsgi = self.app.wsgi()
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/base.py&quot;, line 67, in wsgi
        self.callable = self.load()
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py&quot;, line 49, in load
        return self.load_wsgiapp()
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py&quot;, line 39, in load_wsgiapp
        return util.import_app(self.app_uri)
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/util.py&quot;, line 358, in import_app
        mod = importlib.import_module(module)
      File &quot;/opt/python3.9/lib/python3.9/importlib/__init__.py&quot;, line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1030, in _gcd_import
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 1007, in _find_and_load
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 986, in _find_and_load_unlocked
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 680, in _load_unlocked
      File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 790, in exec_module
      File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 228, in _call_with_frames_removed
      File &quot;/srv/main.py&quot;, line 111, in &lt;module&gt;
        app.run()
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py&quot;, line 990, in run
        run_simple(host, port, self, **options)
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/werkzeug/serving.py&quot;, line 1052, in run_simple
        inner()
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/werkzeug/serving.py&quot;, line 996, in inner
        srv = make_server(
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/werkzeug/serving.py&quot;, line 847, in make_server
        return ThreadedWSGIServer(
      File &quot;/layers/google.python.pip/pip/lib/python3.9/site-packages/werkzeug/serving.py&quot;, line 740, in __init__
        HTTPServer.__init__(self, server_address, handler)
      File &quot;/opt/python3.9/lib/python3.9/socketserver.py&quot;, line 452, in __init__
        self.server_bind()
      File &quot;/opt/python3.9/lib/python3.9/http/server.py&quot;, line 138, in server_bind
        socketserver.TCPServer.server_bind(self)
      File &quot;/opt/python3.9/lib/python3.9/socketserver.py&quot;, line 466, in server_bind
        self.socket.bind(self.server_address)
    OSError: [Errno 98] Address already in use
  </code></pre>