python-microservices/microservices-scaffold

Docker image failed to run gunicorn.errors.HaltServer

Warns opened this issue · 3 comments

Warns commented

Hi,

I'm trying to run your app in a docker container given your instructions, but it fails at run step.

The full run log is as below, you can see the error in the last line as well.

[2020-08-10 15:04:34 +0000] [1] [INFO] Starting gunicorn 19.7.1
[2020-08-10 15:04:34 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
[2020-08-10 15:04:34 +0000] [1] [INFO] Using worker: sync
[2020-08-10 15:04:34 +0000] [8] [INFO] Booting worker with pid: 8
[2020-08-10 15:04:34 +0000] [9] [INFO] Booting worker with pid: 9
[2020-08-10 15:04:34 +0000] [10] [INFO] Booting worker with pid: 10
[2020-08-10 15:04:34 +0000] [18] [INFO] Booting worker with pid: 18
[2020-08-10 15:04:34 +0000] [27] [INFO] Booting worker with pid: 27
[2020-08-10 15:04:34 +0000] [31] [INFO] Booting worker with pid: 31
[2020-08-10 15:04:34 +0000] [33] [INFO] Booting worker with pid: 33
[2020-08-10 15:04:34 +0000] [38] [INFO] Booting worker with pid: 38
ERROR:connexion.apis.abstract:Failed to add operation for POST /template/actors
[2020-08-10 15:04:38 +0000] [8] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 209, in add_paths
    self.add_operation(path, method)
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 173, in add_operation
    pass_context_arg_name=self.pass_context_arg_name
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/__init__.py", line 8, in make_operation
    return spec.operation_cls.from_spec(spec, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/swagger2.py", line 137, in from_spec
    **kwargs
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/swagger2.py", line 96, in __init__
    pass_context_arg_name=pass_context_arg_name
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/abstract.py", line 96, in __init__
    self._resolution = resolver.resolve(self)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 40, in resolve
    return Resolution(self.resolve_function_from_operation_id(operation_id), operation_id)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 64, in resolve_function_from_operation_id
    raise ResolverError(msg, sys.exc_info())
connexion.exceptions.ResolverError: <ResolverError: Cannot resolve operationId "project.actors.post"! Import error was "No module named 'project.actors'">

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 352, in import_app
    __import__(module)
  File "/microservice/manage.py", line 6, in <module>
    app = create_app()
  File "/microservice/project/app.py", line 82, in create_app
    return ms.create_app()
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/app/create_app.py", line 214, in create_app
    self.application = self.init_app()
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/app/create_app.py", line 179, in init_app
    application = self.swagger.init_app(config=self.config.to_flask(), path=self.path)
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/services/swagger.py", line 76, in init_app
    app.add_api(**params)
  File "/usr/local/lib/python3.6/site-packages/connexion/apps/flask_app.py", line 57, in add_api
    api = super(FlaskApp, self).add_api(specification, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/connexion/apps/abstract.py", line 156, in add_api
    options=api_options.as_dict())
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 111, in __init__
    self.add_paths()
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 216, in add_paths
    self._handle_add_operation_error(path, method, err.exc_info)
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 231, in _handle_add_operation_error
    raise value.with_traceback(traceback)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 61, in resolve_function_from_operation_id
    return self.function_resolver(operation_id)
  File "/usr/local/lib/python3.6/site-packages/connexion/utils.py", line 123, in get_function_from_name
    raise last_import_error
  File "/usr/local/lib/python3.6/site-packages/connexion/utils.py", line 111, in get_function_from_name
    module = importlib.import_module(module_name)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'project.actors'
[2020-08-10 15:04:38 +0000] [8] [INFO] Worker exiting (pid: 8)
ERROR:connexion.apis.abstract:Failed to add operation for POST /template/actors
[2020-08-10 15:04:38 +0000] [9] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 209, in add_paths
    self.add_operation(path, method)
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 173, in add_operation
    pass_context_arg_name=self.pass_context_arg_name
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/__init__.py", line 8, in make_operation
    return spec.operation_cls.from_spec(spec, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/swagger2.py", line 137, in from_spec
    **kwargs
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/swagger2.py", line 96, in __init__
    pass_context_arg_name=pass_context_arg_name
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/abstract.py", line 96, in __init__
    self._resolution = resolver.resolve(self)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 40, in resolve
    return Resolution(self.resolve_function_from_operation_id(operation_id), operation_id)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 64, in resolve_function_from_operation_id
    raise ResolverError(msg, sys.exc_info())
connexion.exceptions.ResolverError: <ResolverError: Cannot resolve operationId "project.actors.post"! Import error was "No module named 'project.actors'">

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 352, in import_app
    __import__(module)
  File "/microservice/manage.py", line 6, in <module>
    app = create_app()
  File "/microservice/project/app.py", line 82, in create_app
    return ms.create_app()
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/app/create_app.py", line 214, in create_app
    self.application = self.init_app()
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/app/create_app.py", line 179, in init_app
    application = self.swagger.init_app(config=self.config.to_flask(), path=self.path)
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/services/swagger.py", line 76, in init_app
    app.add_api(**params)
  File "/usr/local/lib/python3.6/site-packages/connexion/apps/flask_app.py", line 57, in add_api
    api = super(FlaskApp, self).add_api(specification, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/connexion/apps/abstract.py", line 156, in add_api
    options=api_options.as_dict())
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 111, in __init__
    self.add_paths()
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 216, in add_paths
    self._handle_add_operation_error(path, method, err.exc_info)
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 231, in _handle_add_operation_error
    raise value.with_traceback(traceback)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 61, in resolve_function_from_operation_id
    return self.function_resolver(operation_id)
  File "/usr/local/lib/python3.6/site-packages/connexion/utils.py", line 123, in get_function_from_name
    raise last_import_error
  File "/usr/local/lib/python3.6/site-packages/connexion/utils.py", line 111, in get_function_from_name
    module = importlib.import_module(module_name)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'project.actors'
[2020-08-10 15:04:38 +0000] [9] [INFO] Worker exiting (pid: 9)
ERROR:connexion.apis.abstract:Failed to add operation for POST /template/actors
[2020-08-10 15:04:38 +0000] [10] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 209, in add_paths
    self.add_operation(path, method)
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 173, in add_operation
    pass_context_arg_name=self.pass_context_arg_name
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/__init__.py", line 8, in make_operation
    return spec.operation_cls.from_spec(spec, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/swagger2.py", line 137, in from_spec
    **kwargs
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/swagger2.py", line 96, in __init__
    pass_context_arg_name=pass_context_arg_name
  File "/usr/local/lib/python3.6/site-packages/connexion/operations/abstract.py", line 96, in __init__
    self._resolution = resolver.resolve(self)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 40, in resolve
    return Resolution(self.resolve_function_from_operation_id(operation_id), operation_id)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 64, in resolve_function_from_operation_id
    raise ResolverError(msg, sys.exc_info())
connexion.exceptions.ResolverError: <ResolverError: Cannot resolve operationId "project.actors.post"! Import error was "No module named 'project.actors'">

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 352, in import_app
    __import__(module)
  File "/microservice/manage.py", line 6, in <module>
    app = create_app()
  File "/microservice/project/app.py", line 82, in create_app
    return ms.create_app()
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/app/create_app.py", line 214, in create_app
    self.application = self.init_app()
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/app/create_app.py", line 179, in init_app
    application = self.swagger.init_app(config=self.config.to_flask(), path=self.path)
  File "/usr/local/lib/python3.6/site-packages/pyms/flask/services/swagger.py", line 76, in init_app
    app.add_api(**params)
  File "/usr/local/lib/python3.6/site-packages/connexion/apps/flask_app.py", line 57, in add_api
    api = super(FlaskApp, self).add_api(specification, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/connexion/apps/abstract.py", line 156, in add_api
    options=api_options.as_dict())
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 111, in __init__
    self.add_paths()
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 216, in add_paths
    self._handle_add_operation_error(path, method, err.exc_info)
  File "/usr/local/lib/python3.6/site-packages/connexion/apis/abstract.py", line 231, in _handle_add_operation_error
    raise value.with_traceback(traceback)
  File "/usr/local/lib/python3.6/site-packages/connexion/resolver.py", line 61, in resolve_function_from_operation_id
    return self.function_resolver(operation_id)
  File "/usr/local/lib/python3.6/site-packages/connexion/utils.py", line 123, in get_function_from_name
    raise last_import_error
  File "/usr/local/lib/python3.6/site-packages/connexion/utils.py", line 111, in get_function_from_name
    module = importlib.import_module(module_name)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'project.actors'
[2020-08-10 15:04:38 +0000] [10] [INFO] Worker exiting (pid: 10)
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 209, in run
    self.sleep()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 359, in sleep
    ready = select.select([self.PIPE[0]], [], [], 1.0)
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 244, in handle_chld
    self.reap_workers()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 524, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/gunicorn", line 8, in <module>
    sys.exit(run())
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 203, in run
    super(Application, self).run()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 231, in run
    self.halt(reason=inst.reason, exit_status=inst.exit_status)
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 344, in halt
    self.stop()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 393, in stop
    time.sleep(0.1)
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 244, in handle_chld
    self.reap_workers()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 524, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

Python and pip updated. Appreciate your help.

Hi @Warns, I'm deeply sorry. The August 10th i was on my holidays and I didn't see the Github notifications. PyMS had a bug with paths. Check this PR and re-run Docker and It will work :)

Thanks for your patience

Hi @Warns, could you confirm if is it all ok? your Docker build works now? If you have other probleme please tell me or open a issue, Thanks for your issue

Warns commented

Indeed it worked, sorry for late answer. Thanks 👍