<@U04S8PLJWMT>, getting error ```Configuration che...
# ask-ai
s
@kapa.ai, getting error
Copy code
Configuration check failed
State code: 53300; Message: FATAL: remaining connection slots are reserved for non-replication superuser, rds_reserved, and rds_superuser connections
k
The error message:
Copy code
Configuration check failed State code: 53300; Message: FATAL: remaining connection slots are reserved for non-replication superuser, rds_reserved, and rds_superuser connections
indicates that your PostgreSQL instance (likely on AWS RDS) has reached its maximum allowed number of database connections. When this happens, only superuser or reserved connections can be made, and all other connection attempts are rejected. This is a common issue when running Airbyte with multiple instances or when Airbyte is configured to use an external Postgres database. Airbyte can open many connections, and if these are not closed properly or if the connection pool settings are too high, you can quickly exhaust the available slots. Relevant solutions and recommendations from the knowledge sources: 1. Reduce Airbyte's Connection Pool Size: Adjust the
SQL_MAX_CONNS
and
SQL_MAX_IDLE_CONNS
environment variables in your Airbyte deployment to lower values. This limits the number of concurrent and idle connections Airbyte will attempt to keep open to the database. This has been shown to resolve similar issues for other users, especially when using external Postgres backends like AWS RDS or GCP Cloud SQL. Example from a user who solved the issue by lowering these values and increasing the DB's
max_connections
parameter: > "I decreased the value of the variables
SQL_MAX_CONNS
and
SQL_MAX_IDLE_CONNS
. I also added a flag on the Cloud SQL DB to accept a higher number of
max_connections
. This solved the issue!" [Airbyte Server unable to start after configuring an external database backend](https://discuss.airbyte.io/t/554) 2. Increase the Database's
max_connections
Setting:
If possible, increase the
max_connections
parameter on your Postgres instance. Be aware that this may have resource implications and should be balanced with your server's capacity. 3. Connection Pooling: Some users have tried using PgBouncer to reduce the number of open connections. However, Airbyte (and especially Temporal) may not work seamlessly with PgBouncer in all modes due to the use of prepared statements. If you attempt this, be aware of potential compatibility issues and test thoroughly. [Scaling Airbyte Instances with PGBouncer - Connection Issues](https://github.com/airbytehq/airbyte/issues/44447) 4. Update Airbyte: In some cases, connection leaks or excessive connections were resolved by updating to a newer version of Airbyte, as improvements and bug fixes are made over time. [Airbyte Internal Database connections are not closed](https://discuss.airbyte.io/t/1953) Summary: You are hitting the Postgres connection limit. Lower Airbyte's connection pool settings (
SQL_MAX_CONNS
,
SQL_MAX_IDLE_CONNS
), and/or increase the database's
max_connections
if possible. If you are running multiple Airbyte instances, consider consolidating or using connection pooling, but be aware of compatibility issues with PgBouncer. If you continue to have issues, check for idle connections that are not being closed and consider updating Airbyte to the latest version.
s
@kapa.ai, if you look at the above response in that case can you let me know, how can i identify number of open connections in airbyte
k
A message from kapa.ai
To identify the number of open connections in Airbyte, you should query the PostgreSQL database that Airbyte is using. One recommended way, as mentioned in the Airbyte community forum, is to run the following SQL command on your Airbyte database:
Copy code
sql SELECT pid, datname, usename, application_name, query_start, wait_event_type, wait_event  FROM pg_stat_activity;
This query will list all current connections to your Postgres database, including details such as process ID, database name, user name, application name, and connection status. By reviewing the output, you can see how many connections are open and which components are using them. This approach was suggested by Airbyte support in response to similar issues with open connections not being closed properly [Database connection not closed properly](https://discuss.airbyte.io/t/405). If you want just the count of open connections, you can use:
Copy code
sql SELECT count(*) FROM pg_stat_activity;
This will give you the total number of open connections at that moment.
s
@kapa.ai, referring to the above response, can i close the open connections using sql
k
A message from kapa.ai
Based on the knowledge sources, there is no explicit mention of closing open Airbyte database connections directly using SQL commands. The recommended approach in the Airbyte community is to identify open connections using queries like
SELECT * FROM pg_stat_activity;
, but there is no guidance on terminating them via SQL. However, in general PostgreSQL administration, you can terminate connections using the following SQL command:
Copy code
sql SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE <your_conditions>;
But the knowledge sources do not explicitly recommend or discuss this approach for Airbyte. Instead, the sources suggest addressing the root cause by adjusting Airbyte's connection pool settings (
SQL_MAX_CONNS
,
SQL_MAX_IDLE_CONNS
) or updating Airbyte to a newer version if you are experiencing connection leaks [Airbyte Server unable to start after configuring an external database backend](https://discuss.airbyte.io/t/554) [Airbyte Internal Database connections are not closed](https://discuss.airbyte.io/t/1953). Summary: You can technically terminate connections in PostgreSQL using SQL, but the Airbyte documentation and community responses do not provide or recommend this as a standard solution. The preferred method is to fix the configuration or update Airbyte to prevent excessive open connections in the first place.
m
@kapa.ai We have deployed Airbyte using helm chart. Can you tell where exactly I need to place above above-suggested envs? And what should be the values for these?
k
A message from kapa.ai
When deploying Airbyte using the Helm chart, you should set environment variables like
SQL_MAX_CONNS
and
SQL_MAX_IDLE_CONNS
in your
values.yaml
file. However, the knowledge sources do not provide explicit documentation or examples for setting these specific environment variables via the Helm chart or
values.yaml
. There is also no official guidance on what the default or recommended values should be for these variables in the context of a Helm deployment. The community and documentation do confirm that these variables are important for controlling database connection usage, and that lowering them can help avoid exhausting your database's connection pool [Airbyte Server unable to start after configuring an external database backend](https://discuss.airbyte.io/t/554). But, the exact location and syntax for setting these environment variables in the Helm chart is not detailed in the provided sources. Summary: - The knowledge sources confirm you should lower
SQL_MAX_CONNS
and
SQL_MAX_IDLE_CONNS
to reduce open connections. - The sources do not specify exactly where or how to set these variables in the Helm chart's
values.yaml
. - The sources do not provide recommended values for these variables. If you need further guidance, you may need to consult the official Airbyte Helm chart documentation or reach out to the Airbyte community for up-to-date best practices on setting these environment variables in a Helm deployment.
m
@kapa.ai In the values file, there are various parameters. Tell me exactly under which parameter? Temporal, webapp, worker etc?
k
A message from kapa.ai
Based on the knowledge sources, the exact placement of environment variables like
SQL_MAX_CONNS
and
SQL_MAX_IDLE_CONNS
in the Airbyte Helm chart's
values.yaml
is not explicitly documented. The sources do not specify whether these should go under
worker
,
temporal
,
webapp
, or any other specific section. However, there is a relevant example from a community discussion about setting worker-related environment variables (such as
MAX_SYNC_WORKERS
) under the
worker.env_vars
section in `values.yaml`:
Copy code
yaml worker:   env_vars:     MAX_SYNC_WORKERS: 12     MAX_CHECK_WORKERS: 12
But for
SQL_MAX_CONNS
and
SQL_MAX_IDLE_CONNS
, the knowledge sources do not confirm if these should be placed under
worker.env_vars
or another section. There is no direct documentation or example for these specific variables in the provided sources [Support the MAX_*_WORKERS environment variables in the Helm chart](https://github.com/airbytehq/airbyte/issues/29547). Summary: The knowledge sources do not provide enough information to state exactly under which parameter (
worker
,
temporal
,
webapp
, etc.) you should place
SQL_MAX_CONNS
and
SQL_MAX_IDLE_CONNS
in your
values.yaml
file. If you need precise placement, you may need to consult the official Airbyte Helm chart documentation or reach out to the Airbyte community for clarification.