Database connection not correctly closed (OD-2286)
Lukas opened 11 months ago

Hello,

when using Helm to deploy OneDev, it seems like it is not closing the connections to the database properly, when OneDev is closed.. An update is failling typically with the error message, that there are no more connection available because all of them are used. When looking at the postgres instance, all connections are taken up by OneDev but are idle.

  • Robin Shen commented 11 months ago

    Can you please describe steps to reproduce? Like how you are setting up OneDev with postgres instance, and how you are closing OneDev, etc.

  • Lukas commented 11 months ago

    The database is set up with the helm through the database settings in the values.yaml. When a new version is available, a SIGTERM signal is sent to OneDev as part of the helm upgrade command.

    Lifecycle

    I assume that here the database connection are not terminated successfully, bceause when the new instance tries to connect to Postgres, the application fails with the reason, that there are no more non-administration connection available.

  • Robin Shen commented 11 months ago

    Tried with below procedure but can not reproduce:

    1. Create a new k8s cluster at GKS

    2. Run below command to deploy PostgreSQL and OneDev 11.6.10:

      kubectl create namespace onedev
      helm install mypostgres bitnami/postgresql --namespace onedev
      kubectl get secret --namespace onedev mypostgres-postgresql -o jsonpath="{.data.postgres-password}"|base64 --decode
      helm install onedev onedev/onedev -n onedev --set database.external=true --set database.type=postgresql --set database.host=mypostgres-postgresql --set-string database.port=5432 --set database.name=onedev --set database.user=postgres --set database.password=<decoded password from previous command> --set image.tag=11.6.10
      
    3. Access OneDev UI to set up the server and add a test project

    4. Run below command to upgrade OneDev to 11.6.16:

      helm upgrade onedev onedev/onedev -n onedev --set image.tag=11.6.16 --reuse-values
      

    After OneDev up and running after upgrade, check the opened database connections of postgresql, and it is still 25 (which is the default).

  • Lukas commented 10 months ago

    Thank you for the reply and help.

    Okay - then I am not sure what is happening. I'll just make sure to close all database connections manually before updating. This has been the approach so far, so it should be fine.

    Thanks again!

  • Lukas changed state to 'Closed' 10 months ago
    Previous Value Current Value
    Open
    Closed
issue 1/1
Type
Bug
Priority
Normal
Assignee
Affected Versions
11.6.16 & previous
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2286
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover