Forum Stats

  • 3,826,761 Users
  • 2,260,705 Discussions
  • 7,897,072 Comments

Discussions

Deadlock in Berkeley DB?

User_3BRQG
User_3BRQG Member Posts: 1 Green Ribbon

I'm using berkeley db to store 100 milion keys and theirs values. There is one instance of berkeley db on the server. One writer adds and removes records and five readers (five independent applications) read proper values.

Sometimes one of my readers stucks and I have to kill it and run it again. I attached to it using gdb:

[Switching to LWP 100674 of process 54232]
0x0000000000886771 in __lock_ohash ()
(gdb) where
#0  0x0000000000886771 in __lock_ohash ()
#1  0x000000000087a1c4 in __lock_get_internal ()
#2  0x00000000008793d4 in __lock_vec ()
#3  0x000000000078e094 in __db_lget ()
#4  0x00000000007ff26d in __bam_search ()
#5  0x00000000007f07f6 in __bamc_search ()
#6  0x00000000007edb13 in __bamc_get ()
#7  0x0000000000783091 in __dbc_iget ()
#8  0x000000000078b793 in __dbc_get_pp ()
#9  0x0000000000762a5a in Dbc::get(Dbt*, Dbt*, unsigned int) ()
...

Why does it stuck in __lock_ohash() function? When it stucks the whole application freezes until I kill it. Is it a deadlock? Why database does not manage and solve it?

Version of berkeley db: 18.1.40

Flags used by writer and readers:

  uint32_t flags = DB_INIT_LOCK | DB_INIT_MPOOL | DB_SYSTEM_MEM | DB_INIT_TXN |
                   DB_CREATE | DB_REGISTER;

OS: FreeBSD 13.0-RELEASE-p6

Shared memory info:

[[email protected] ~]$ ipcs -M
shminfo:
    shmmax:   4294967296    (max shared memory segment size)
    shmmin:            1    (min shared memory segment size)
    shmmni:          192    (max number of shared memory identifiers)
    shmseg:          128    (max shared memory segments per process)
    shmall:      1048576    (max amount of shared memory in pages)

Database size - 4,6 GB:

[[email protected] ~/adg_db/Database/database]$ ls -ltrh
total 3349522
-rw-r-----  1 adg  adg    10M Mar 13 23:11 log.0000000001
-rw-r-----  1 adg  adg   4.6G Mar 14 09:26 adgdatabase.db
-rw-r-----  1 adg  adg    24B Mar 14 09:29 __db.001
-rw-r-----  1 adg  adg   200B Mar 14 09:30 __db.register