-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Alembic migration causes: ConnectionRefusedError: [Errno 111] Connect call #16959
Comments
@adam-brusselback sorry you're running into this; that is indeed confusing. Here's something that might help you isolate the issue:
This second command may help you determine if something is going on with a bad alembic configuration or something else since you can decouple these two aspects of startup. |
Sadly, that doesn't work. EDIT: Okay, figured out a workaround. First I start the container with migrate_on_start=true, then I modify the setting and do a helm update and it creates a new pod with migrate_on_start=false, which then allows me to get into the pod's shell and run But when I do that, it works perfectly.
I ran the database upgrade twice to make sure it wasn't something that worked the first time, and failed the second time. So i'm at even more of a loss now. |
@adam-brusselback is CNPG a part of the full helm setup and being deployed at the same time as the Prefect server? This all sounds like the database isn't actually ready until some non-trivial amount of time after the Another quick-to-implement option which is ugly but seems like it would work is to change the pod's command from |
Yes, they are deployed from the same chart at the same time. Will give that a shot tomorrow. I wouldn't have thought that would be an issue considering the whole pod is restarted until the database eventually comes online. Once the DB is online (1+ min) the prefect pod stops restarting, the migrations run, and I can access the UI (until that original error occurs after a couple min). |
Bug summary
I have Prefect deployed in a local k8s cluster along with CNPG in a single namespace (
test-client
).I have the database connection setup correctly as far as I can tell. The prefect-server pod starts up fine, I can access the UI, I can even add a variable that I can subsequently query from the DB and see in the
variable
table.But the pod then crashes after some short amount of time and throws the following error:
ConnectionRefusedError: [Errno 111] Connect call failed ('10.43.121.165', 5432)
which the stack-trace indicates is caused by running the alembic migrations on startup.The pod will then restart, and attempt to do the migration again (causing another error after some amount of time).
I've attempted to debug the best I can. I can connect to the database just fine from within the prefect-server pod by running:
Which gives me a
Successfully connected!
message.Any help would be greatly appreciated, as I have exhausted the ways I know to debug this type of problem.
Version info
Additional context
Here is the stacktrace for the error:
The text was updated successfully, but these errors were encountered: