-
Notifications
You must be signed in to change notification settings - Fork 499
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
Horizon: does not exit if database connection fails #898
Comments
I'm not sure how this can happen because we indeed check for necessary migrations before starting the server. Can I know how you can reproduce it with CLI? @gracenoah |
This happened on horizon 0.16.0. It looks like the code you are pointing to is way newer than that... I tried to dig farther back into the history of this code, and it seems like the migration check was added before 0.16.0 even though the code looked pretty different: f931bc7 I guess I'll try upgrading and let you know if CI starts failing intermittently with the same issue again. |
@gracenoah that sounds good to me! Do let me know once you upgrade it and test it out so I can do what's needed to close this issue 😃 |
Well, I'm running into a new failure mode with the latest version of the horizon image in CI: https://gist.github.com/gracenoah/c1ac539daf724b03554e5f491e022ff6 I'm not sure if this is an issue with the image, an issue with horizon or an issue with the way docker compose is starting the db in parallel with horizon and letting horizon just keep crashing until it succeeds to start up. It looks like the postgres image starts postgres briefly to do some sort of initialization. I think the issue is that gorp_migrations table is created outside of a transaction the init process and then init fails, but migrate up doesn't get run.
I don't know if this is the same error or a new one, but it's way clearer what goes wrong. A workaround can be done in the image, but I do think that |
@bartekn does this make sense to you? I don't understand why this
can happen |
I think this is it: https://github.com/docker-library/postgres/blob/master/docker-entrypoint.sh#L124 |
Hmm.. there was an issue about this not that long ago: docker-library/postgres#440. We use postgres:9.6.11-alpine@sha256:9ca98c730b23ecf4e0f89c4acc070ece194f43032f88e4b89a2bf942cb281b9e and I don't think that's too old, but I'll try upgrading the docker image to try to mitigate this issue for now. |
Oops, I was able to verify that my current version of the image already has this fix:
I don't think it'll be easy to fix this by changing the postgres docker image. I would really prefer to have a fix in horizon itself. |
I found a workaround that seems to work. Running |
This is very old issue that seems to be resolved. If not, let me know! |
In satoshipay/docker-stellar-horizon#10 it has been observed that Horizon does not exit (with a non-zero exit code) if the database connection fails when it's starting up. Instead the HTTP server starts up but requests fail.
The text was updated successfully, but these errors were encountered: