If this has never happened before, and only just started happening, then
*something* must have changed. Might be worth figuring that out.

A database becomes locked like this only when two instances are trying to
connect to the same H2 database file, or one crashed somehow without
releasing the lock. Probably need to see the full error/stack trace to see
the root cause, however usually it's something like "Caused by:
java.lang.IllegalStateException: The file is locked:
nio:/godata/db/h2db/cruise.mv.db [1.4.200/7]"

I suggest you look inside the GoCD server log file more directly, not just
k8s stats. GoCD runs as a multi-process container, and has its own process
manager (Tanuki Java wrapper) so it is possible that even without
Kubernetes showing container or pod restarts that GoCD itself has been
restarted by the Tanuki process manager. it will log when it does so. I'd
look for when the errors started, and then scroll back through the
container logs to see if the process was restarted by Tanuki. It will
restart the main JVM if it thinks the main server process is not
responding, or due to OOM errors etc. Perhaps the lock is not being
released fast enough. Anyway - your root problem may be heap
size/memory/CPU constraints rather than the database itself.

Even if you use Postgres, if you have cases where there are two GoCD server
instances overlapping or trying to share the database file you will have
other issues of some sort (due to race conditions) and if you have some
other server stability issue causing restarts it's probably wise to
understand how it is getting into this state first so you're addressing the
right problem.

As for migration to Postgres, the docs are at
https://github.com/gocd/gocd-database-migrator . There's nothing specific
for EKS/Kubernetes however generally speaking you'd need to

   - prepare your postgres instance per
   https://docs.gocd.org/current/installation/configuring_database/postgres.html
   - (when ready to do the "proper" run) stop your GoCD server instance
   - get your H2 DB file off EFS somewhere to run the migration tool against
   - run the migrator tool
   - change GoCD server Helm chart to mount the db.properties that tell it
   how to connect to Postgres
   - start the GoCD server instances against postgres


-Chad

On Wed, Sep 11, 2024 at 9:56 AM Komgrit Aneksri <tanakacu...@gmail.com>
wrote:

> I have no any change in configurations.
>
> But We have add new users and new pipelines every day.
>
> Pods is still running status and no restart/spawn/evicted.
>
> If we have to migrate h2 to postgresql. Do you have any migration
> documentations for K8s?
>
> Regards,
> Komgrit
> On Tuesday, September 10, 2024 at 10:32:31 PM UTC+7 Chad Wilson wrote:
>
>> What changed in your setup when this started happening?
>>
>> Is your GoCD server pod crashing and being automatically restarted? Are
>> nodes it is running on dying and the pod being re-scheduled elsewhere?
>>
>> On Tue, 10 Sept 2024, 17:02 Komgrit Aneksri, <tanak...@gmail.com> wrote:
>>
>>> Hi team,
>>>
>>> I am facing issue about database.
>>>
>>> Error message below
>>> Could not open JDBC Connection for transaction; nested exception is
>>> org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database may be already
>>> in use: null. Possible solutions: close all other connection(s); use the
>>> server mode [90020-200]
>>>
>>> Now I did restarted the gocd server then it is back to normal now.
>>>
>>> I used GoCD version 23.1.0 running on EKS
>>>
>>> And store files and database (h2) on EFS.
>>>
>>> I have found this issue 2 times to now (last Thursday and today)
>>>
>>> Cloud you please help me what should improve for fix this issue?
>>>
>>> Best regards,
>>> Komgrit
>>>
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "go-cd" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to go-cd+un...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/go-cd/9d1a20c3-b463-4dd3-a376-b2bcd014091cn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/go-cd/9d1a20c3-b463-4dd3-a376-b2bcd014091cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "go-cd" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to go-cd+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/go-cd/30709745-11f5-40dc-a194-0365f39a1c1en%40googlegroups.com
> <https://groups.google.com/d/msgid/go-cd/30709745-11f5-40dc-a194-0365f39a1c1en%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to go-cd+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/CAA1RwH8vR4CGb_vScaM0fUcjrKsThcOf05H5MTzRz7TUvN9w_g%40mail.gmail.com.

Reply via email to