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

Race condition issue with generated sys.config #568

Closed
imranismail opened this issue Oct 11, 2018 · 11 comments
Closed

Race condition issue with generated sys.config #568

imranismail opened this issue Oct 11, 2018 · 11 comments

Comments

@imranismail
Copy link
Contributor

Steps to reproduce

There are times where the app would boot up before the sys.config generation resolves.

And db_connection/ecto would complain about missing database config.

Rebooting the app resolves the issue.

Verbose Logs

Paste the output of the release command you ran with the --verbose flag
below in the summary tags (this helps keep the issue easy to navigate):

14:18:13.253 [error] GenServer #PID<0.2907.0> terminating
** (RuntimeError) Connect raised a KeyError error. The exception details are hidden, as
they may contain sensitive data such as database credentials.

    (elixir) lib/keyword.ex:386: Keyword.fetch!/2
    (postgrex) lib/postgrex/protocol.ex:98: Postgrex.Protocol.connect/1
    (db_connection) lib/db_connection/connection.ex:135: DBConnection.Connection.connect/2
    (connection) lib/connection.ex:622: Connection.enter_connect/5
    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
@imranismail
Copy link
Contributor Author

This is a deal breaker for us. We are still not confident to deploy distillery 2.0 because of this

@arjan
Copy link

arjan commented Oct 11, 2018

How are you configuring Ecto? Would be handy to provide some more details on your config situation.

@imranismail
Copy link
Contributor Author

imranismail commented Oct 11, 2018 via email

@aquarhead
Copy link

Is the config provider reading from the network? Is it possible to output the value during running config provider phase?

@imranismail
Copy link
Contributor Author

How do I do that @aquarhead

@aquarhead
Copy link

I'm not using config providers (yet), so just wondering whether you can use IO.inspect and check whether values exist at that point (first start). Or write out the values to another file (if stdout is not attachable)

@imranismail
Copy link
Contributor Author

imranismail commented Oct 15, 2018

I will set this up and report back.

But just to clarify I am not using any sort of config providers over the network.

I'm using the built in Elixir config provider.

Generated sys.config looks about right, however the config is not loaded.

@imranismail
Copy link
Contributor Author

@aquarhead @bitwalker I've confirmed this via attach command after start command.

Had to run the start then attach command combination several times to reproduce the error.

The results are

[
  {App.Repo, [adapter: Ecto.Adapters.Postgres]}
]

When it should be as per sys.config

[
  {App.Repo, [
     adapter: Ecto.Adapters.Postgres,
     username: "redacted",
     password: "redacted",
     hostname: "redacted",
     database: "redacted",
     pool_size: 10,
     pool_overflow: 20,
     port: 5432
  ]}
]

@imranismail imranismail changed the title Possible race condition issue with generated sys.config [CONFIRMED] Possible race condition issue with generated sys.config Oct 15, 2018
@imranismail imranismail changed the title [CONFIRMED] Possible race condition issue with generated sys.config Race condition issue with generated sys.config Oct 29, 2018
@imranismail
Copy link
Contributor Author

Any update on this?

@cvortmann
Copy link

cvortmann commented Feb 14, 2019

I've left a couple of comments on #275 (comment) about a race condition with sys.config generation that seems to be related to the issue being discussed here.

@bitwalker
Copy link
Owner

This should no longer be an issue with the latest versions, a signficant amount has changed since this issue was first reported

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

5 participants