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

Vweb DatabasePool connection closed unexpectedly after idle time #19895

Open
ajozz13 opened this issue Nov 16, 2023 · 5 comments
Open

Vweb DatabasePool connection closed unexpectedly after idle time #19895

ajozz13 opened this issue Nov 16, 2023 · 5 comments
Labels
Bug This tag is applied to issues which reports bugs. Unit: vweb Bugs/feature requests, that are related to the `vweb`.

Comments

@ajozz13
Copy link

ajozz13 commented Nov 16, 2023

Describe the bug

Using a similar setup app as shown here: #18191
and Postgresql database, I noticed that after idle db connection the server unexpectly closes the connection and the container running the vweb app crashes, Is there a way to reset the db connection after a specific period of time (before the idle time of the server) or when the db connections are needed to be created (on demand)?

Reproduction Steps

application setup and running Ok
wait about 20 minutes Idle and attempt to request a resource on the DB the server closes the connection unexpectedly

Expected Behavior

  • connection pool recycle idle connections
  • user configured timeout period

Current Behavior

1 long standing connection is closed after idle period
1 possible workaround is to setup a health check to make a query thereby keeping the connection busy

Possible Solution

1 possible workaround is to setup a health check to make a query thereby keeping the connection busy

Additional Information/Context

No response

V version

0.4.2

Environment details (OS name and version, etc.)

Docker alpine latest (vlang 0.4.2)

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@ajozz13 ajozz13 added the Bug This tag is applied to issues which reports bugs. label Nov 16, 2023
@ArtemkaKun ArtemkaKun added the Unit: vweb Bugs/feature requests, that are related to the `vweb`. label Nov 16, 2023
@Casper64
Copy link
Member

Hi can you confirm the idle connection is closed by V and not the postgres server? There is a setting in postgres where you can change the idle timeout.

I've been running a vweb app with the connection pool for 4 months now without breaking, I want to confirm it this could have happened due to a change between that time

@ajozz13
Copy link
Author

ajozz13 commented Nov 19, 2023 via email

@einar-hjortdal
Copy link
Contributor

I actually just experienced this issue today with mysql. Mysql disconnected the client for inactivity (code: 4031)

@Casper64
Copy link
Member

I will take this issue into account for vweb2, the underlying implementation of the database pool has to change anyway.

@ajozz13
Copy link
Author

ajozz13 commented Nov 27, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Unit: vweb Bugs/feature requests, that are related to the `vweb`.
Projects
None yet
Development

No branches or pull requests

4 participants