Hi Julia

This seems odd. My understanding is that by default the H2 database uses a
file system based lock to get exclusive access to the file. The default
mechanism did change between the H2 versions used by 21.4.0 and 21.5.0.

   - Does the server recover after some time, or you need to restart GoCD
   or take some other action to fix it?
   - How are you running GoCD? i.e in which environment? Container?
   Standard server?
   - Is your DB file on some kind of network mount or something like that?
   - Is there a way to verify there aren't multiple processes/GoCD
   Instances trying to access the file?
      - when it happens, are you able to use OS-level commands such as lsof
      to see if other/multiple processes have handles on the DB file
(depends on
      whether storage is local)
   - Would be good to confirm you don't see GoCD crashing or getting
   auto-restarted in your logs to rule out GoCD itself having a different
   problem, and then this problem is being caused by a zombie GoCD process or
   some kind of stale lock which takes time to expire.
   - Do you have any overrides to DB configuration, e.g a custom
   *config/db.properties* file?

To answer your question on the trace files, I think you get two files when
the main trace file reaches an H2-configured maximum size. I ask the above
question on DB properties as I think GoCD sets that to 16MB by default,
whereas yours seems to have got to 64MB which seems curious.

There is a way to change the locking approach H2 uses
<https://www.h2database.com/html/advanced.html#file_locking_protocols>
(back to the older ;FILE_LOCK=FS - which creates the stale cruise.lock.db
you have in your screenshot) if the issue is with the filesystem, however I
imagine you'd want to rule out multiple processes or some other issue first.

-Chad

On Thu, May 19, 2022 at 3:15 PM AquilaNiger <[email protected]> wrote:

> Hi everyone,
>
> I really need your help. Previously we were using GoCD 20.1.0 and we
> upgraded to 22.1.0 recently, including database migration. Everthing went
> well and the server is running as usual. However, every now and then (no
> clue how to reproduce that) the database is locked and errors like these
> add up:
>
> Hibernate operation: could not inspect JDBC autocommit mode; ... Database
> may be already in use: null. Possible solutions: close all other
> connection(s); use the server mode [90020-200]; 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]
> Hibernate operation: could not execute query; ... Database may be already
> in use: null. Possible solutions: close all other connection(s); use the
> server mode [90020-200]
> 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]
>
> Additionally I can see that in the database directory, two traces are
> written, the old and the new one. Is that "works as designed"?
>
> [image: trace.png]
>
> Both traces contain stacktraces like this one:
> database: flush
> org.h2.message.DbException: General error:
> "java.lang.IllegalStateException: The file is locked:
> nio:/var/lib/go-server/db/h2db/cruise.mv.db [1.4.200/7]" [50000-200]...
> ...
>
> What's wrong with the installation? Is there any option or setting in H2
> that we could change to fix the issue? Is it correct that two trace files
> are written? Any idea or help is highly appreciated, otherwise I don't
> think we can get rid of the issue without a complete new installation.
>
> Thanks in advance!
> Julia
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/go-cd/f2255549-a517-48a8-b9d0-db6f22eea980n%40googlegroups.com
> <https://groups.google.com/d/msgid/go-cd/f2255549-a517-48a8-b9d0-db6f22eea980n%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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/go-cd/CAA1RwH_WWW4JzCn1%2BjpCS9qoMfbo2_7w9_7AYwjpP%3DUiaWCuuQ%40mail.gmail.com.

Reply via email to