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

Connection request timed out on heavy traffic #716

Open
Huddie opened this issue Jan 5, 2021 · 5 comments
Open

Connection request timed out on heavy traffic #716

Huddie opened this issue Jan 5, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@Huddie
Copy link

Huddie commented Jan 5, 2021

Describe the bug

When running a Postgres instance I sometimes get back:

[ERROR] Connection request timed out. This might indicate a connection deadlock in your application.

I've tried updating the connectionPoolTimeout to 1 min but still get this error. It also usually gets up throwing many of these errors in a row until (maybe?) the connection recovers?

    try app.databases.use(
        .postgres(url: Environment.get("POSTGRES_URL")!,
                  connectionPoolTimeout: .minutes(1)
        ),
        as: .psql
    )

It has to deal with maybe 40/50 incoming requests at the same time. It seems to usually do fine when only 5/10 requests are arriving.

To Reproduce

Setup postgres instance with the above init and send maybe 40/50 to the vapor server which processes a filter to retrieve some object from the db.

Expected behavior

A clear and concise description of what you expected to happen.

Environment

note: no Package.resolved file was found.
framework: not found
toolbox: 18.3.0

Not sure why framework is not found.

        .package(url: "https://github.com/vapor/vapor.git", from: "4.0.0"),
        .package(url: "https://github.com/vapor/fluent.git", from: "4.0.0"),
        .package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.0.0"),

This is running on kubernetes dockerized using the default dockerfile more or less.

@Huddie Huddie added the bug Something isn't working label Jan 5, 2021
@0xTim
Copy link
Member

0xTim commented Mar 5, 2021

@Huddie there have been some major improvements to the underlying PostgresNIO driver - are you still seeing this issue?

@Huddie
Copy link
Author

Huddie commented Mar 5, 2021

I will update and get back to you thanks so much

@georgmay
Copy link

I'm experiencing the same issue using Fluent + MySQL

@Huddie
Copy link
Author

Huddie commented Apr 25, 2021

I haven't gotten a chance to check so could still be happening for me as well.

@kylebrowning
Copy link
Member

This is still happening for postgres, but does not happen for mysql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants