Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

superset_init fails after upgrading to 3.0.0 when loading some default examples #25506

Open
3 tasks done
bukem opened this issue Oct 4, 2023 · 4 comments
Open
3 tasks done

Comments

@bukem
Copy link

bukem commented Oct 4, 2023

How to reproduce the bug

  1. Install superset version 3.0.0 using docker compose
  2. Apply the fix described in superset_init fails after upgrading to 3.0.0 due to alembic migrations misconfiguration #25505 update alembic_version set version_num = 'ec54aca4c8a2' where version_num = '4b85906e5b91';
  3. Apply the fix described in superset can not login on browser #25471 by adding the following to docker/pythonpath_dev/superset_config_docker.py
WTF_CSRF_ENABLED = False
TALISMAN_ENABLED = False
  1. Start superset using $ TAG=3.0.0 docker compose -f docker-compose-non-dev.yml up
  2. In the output we see the following:
superset_init         | Init Step 4/4 [Starting] -- Loading examples
superset_init         |
superset_init         |
superset_init         | ######################################################################
superset_init         |
superset_init         |
superset_init         | logging was configured successfully
superset_init         | 2023-10-04 00:36:41,865:INFO:superset.utils.logging_configurator:logging was configured successfully
superset_init         | 2023-10-04 00:36:41,871:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'
>
superset_init         | We haven't found any Content Security Policy (CSP) defined in the configurations. Please make sure to confi
gure CSP using the TALISMAN_ENABLED and TALISMAN_CONFIG keys or any other external software. Failing to configure CSP have serious
security implications. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP for more information. You can disable this warning using the CONTENT_SECURITY_POLICY_WARNING key.
superset_init         | 2023-10-04 00:36:41,872:WARNING:superset.initialization:We haven't found any Content Security Policy (CSP)
defined in the configurations. Please make sure to configure CSP using the TALISMAN_ENABLED and TALISMAN_CONFIG keys or any other e
xternal software. Failing to configure CSP have serious security implications. Check https://developer.mozilla.org/en-US/docs/Web/H
TTP/CSP for more information. You can disable this warning using the CONTENT_SECURITY_POLICY_WARNING key.
...
superset_init         | 2023-10-04 00:36:43,316 INFO sqlalchemy.engine.Engine ROLLBACK
superset_init         | 2023-10-04 00:36:43,316:INFO:sqlalchemy.engine.Engine:ROLLBACK
superset_init         | Traceback (most recent call last):
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3280, in _wrap_pool_connect
superset_init         |     return fn()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 310, in connect
superset_init         |     return _ConnectionFairy._checkout(self)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 868, in _checkout
superset_init         |     fairy = _ConnectionRecord.checkout(pool)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 476, in checkout
superset_init         |     rec = pool._do_get()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
superset_init         |     return self._create_connection()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 256, in _create_connection
superset_init         |     return _ConnectionRecord(self)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 371, in __init__
superset_init         |     self.__connect()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 666, in __connect
superset_init         |     pool.logger.debug("Error on connect(): %s", e)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
superset_init         |     compat.raise_(
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
superset_init         |     raise exception
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
superset_init         |     self.dbapi_connection = connection = pool._invoke_creator(self)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/create.py", line 590, in connect
superset_init         |     return dialect.connect(*cargs, **cparams)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 597, in connect
superset_init         |     return self.dbapi.connect(*cargs, **cparams)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
superset_init         |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
superset_init         | psycopg2.OperationalError: could not translate host name "db" to address: Name or service not known
superset_init         |
superset_init         |
superset_init         | The above exception was the direct cause of the following exception:
superset_init         |
superset_init         | Traceback (most recent call last):
superset_init         |   File "/usr/local/bin/superset", line 33, in <module>
superset_init         |     sys.exit(load_entry_point('apache-superset', 'console_scripts', 'superset')())
superset_init         |   File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
superset_init         |
superset_init         |     return self.main(*args, **kwargs)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
superset_init         |     rv = self.invoke(ctx)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
superset_init         |     return _process_result(sub_ctx.command.invoke(sub_ctx))
superset_init         |   File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
superset_init         |     return ctx.invoke(self.callback, **ctx.params)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
superset_init         |     return __callback(*args, **kwargs)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func
superset_init         |     return f(get_current_context(), *args, **kwargs)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/flask/cli.py", line 357, in decorator
superset_init         |     return __ctx.invoke(f, *args, **kwargs)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
superset_init         |     return __callback(*args, **kwargs)
superset_init         |   File "/app/superset/cli/examples.py", line 113, in load_examples
superset_init         |     load_examples_run(load_test_data, load_big_data, only_metadata, force)
superset_init         |   File "/app/superset/cli/examples.py", line 49, in load_examples_run
superset_init         |     examples.load_world_bank_health_n_pop(only_metadata, force)
superset_init         |   File "/app/superset/examples/world_bank.py", line 54, in load_world_bank_health_n_pop
superset_init         |     schema = inspect(engine).default_schema_name
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/inspection.py", line 64, in inspect
superset_init         |     ret = reg(subject)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/reflection.py", line 182, in _engine_insp
superset_init         |     return Inspector._construct(Inspector._init_engine, bind)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/reflection.py", line 117, in _construct
superset_init         |     init(self, bind)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/reflection.py", line 128, in _init_engine
superset_init         |     engine.connect().close()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3234, in connect
superset_init         |     return self._connection_cls(self, close_with_result=close_with_result)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 96, in __init__
superset_init         |     else engine.raw_connection()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3313, in raw_connection
superset_init         |     return self._wrap_pool_connect(self.pool.connect, _connection)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3283, in _wrap_pool_connect
superset_init         |     Connection._handle_dbapi_exception_noconnection(
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2117, in _handle_dbapi_exce
ption_noconnection
superset_init         |     util.raise_(
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
superset_init         |     raise exception
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 3280, in _wrap_pool_connect
superset_init         |     return fn()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 310, in connect
superset_init         |     return _ConnectionFairy._checkout(self)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 868, in _checkout
superset_init         |     fairy = _ConnectionRecord.checkout(pool)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 476, in checkout
superset_init         |     rec = pool._do_get()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
superset_init         |     return self._create_connection()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 256, in _create_connection
superset_init         |     return _ConnectionRecord(self)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 371, in __init__
superset_init         |     self.__connect()
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 666, in __connect
superset_init         |     pool.logger.debug("Error on connect(): %s", e)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
superset_init         |     compat.raise_(
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 207, in raise_
superset_init         |     raise exception
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py", line 661, in __connect
superset_init         |     self.dbapi_connection = connection = pool._invoke_creator(self)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/create.py", line 590, in connect
superset_init         |     return dialect.connect(*cargs, **cparams)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 597, in connect
superset_init         |     return self.dbapi.connect(*cargs, **cparams)
superset_init         |   File "/usr/local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
superset_init         |     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
superset_init         | sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not translate host name "db" to address:
 Name or service not known
superset_init         |
superset_init         | (Background on this error at: https://sqlalche.me/e/14/e3q8)
superset_init         |
superset_init exited with code 1

Workaround
Comment SUPERSET_LOAD_EXAMPLES=yes in docker/.env-non-dev and restart the services:

...
superset_init         | ######################################################################
superset_init         |
superset_init         |
superset_init         | Init Step 3/4 [Complete] -- Setting up roles and perms
superset_init         |
superset_init         |
superset_init         | ######################################################################
superset_init         |
superset_init         |
superset_init exited with code 0

Actually, it feels like the issue is caused by the database configuration set in docker/.env-non-dev, but decided not to experiment with it since there is comment # database configurations (do not modify) and skipping the example block looks like a much simpler solution.

Expected results

No errors during the service start.

Actual results

superset_init container status is Exited (1)

Environment

  • superset version: Superset 3.0.0
  • python version: Python 3.9.16
$ docker ps -a
[report@armrep superset]$ docker ps -a
CONTAINER ID   IMAGE                                                  COMMAND                  CREATED          STATUS                      NAMES
eae9ce18f86d   apachesuperset.docker.scarf.sh/apache/superset:3.0.0   "/app/docker/docker-…"   39 minutes ago   Up 12 minutes (healthy)     superset_worker
d03dbd3b815a   apachesuperset.docker.scarf.sh/apache/superset:3.0.0   "/app/docker/docker-…"   39 minutes ago   Up 12 minutes (healthy)     superset_app
6dc22b0ffded   apachesuperset.docker.scarf.sh/apache/superset:3.0.0   "/app/docker/docker-…"   39 minutes ago   Exited (1) 12 minutes ago   superset_init
69a41f099a15   apachesuperset.docker.scarf.sh/apache/superset:3.0.0   "/app/docker/docker-…"   39 minutes ago   Up 12 minutes               superset_worker_beat
ab393ec6595b   redis:7                                                "docker-entrypoint.s…"   39 minutes ago   Up 12 minutes               superset_cache
e700220c988f   superset-websocket                                     "docker-entrypoint.s…"   20 hours ago     Exited (1) 20 hours ago     superset_websocket
f291bc14ddd1   node:16                                                "docker-entrypoint.s…"   20 hours ago     Exited (137) 20 hours ago   superset_node

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.
@aimmon
Copy link

aimmon commented Oct 23, 2023

Excuse me, has it been resolved? I also have the same error,
could not translate host name "db" to address: Name or service not known

@bukem
Copy link
Author

bukem commented Oct 24, 2023

Excuse me, has it been resolved? I also have the same error, could not translate host name "db" to address: Name or service not known

@aimmon nope. 3.0.1 still has this issue. Just apply the workaround and enjoy the service

@rajivpatki
Copy link

Excuse me, has it been resolved? I also have the same error, could not translate host name "db" to address: Name or service not known

Can you share your docker-compose? Does your postgres database have container_name: db and superset has depends_on: db?

@bukem
Copy link
Author

bukem commented Mar 17, 2024

@rajivpatki my setup doesn't have database db. I suppose it is not required. At least itb wasn't an issue before that change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants