Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Deadlock in Berkeley DB?

User_3BRQGMar 14 2022

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:

[adg@ovhs8 ~]$ 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:

[adg@ovhs8 ~/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

Comments

MartinBach-Oracle Jan 8 2025

Hi Salomon,

please have a look at this blog post written by @ulrike-schwinn-oracle :

https://blogs.oracle.com/coretec/post/easy-sql-statement-tracking-in23c

I hope this answers your question, if not, please shout!

- Martin

Solomon Yakobson Jan 8 2025

@martinbach-oracle - No, it doesn't answer my question. Article you pointed to shows uses:

SQL> alter system set sql_history_enabled=true scope=both;

And in my post I said “Works fine when enabled on system level”. My question was about

SQL> ALTER SESSION SET SQL_HISTORY_ENABLED = TRUE;

where I showed SQL history was NOT captured even though it should be based on SQL_HISTORY_ENABLED:

Modifiable **ALTER SESSION**, ALTER SYSTEM

SY.

MartinBach-Oracle Jan 8 2025

As per the article I shared the situation is as follows at the moment

  • You must enable SQL history PDB-wide (only a DBA can do that) so there's a certain level of control over the feature
  • Your session has access to the SQL history
  • If you don't want to record anything, set sql_history_enabled to false.

I'm currently assessing if that's intended behaviour (in which case the documentation should be amended) or a feature not working as it should (in which case it needs fixing). The parameter is indeed session-modifyable, but not in the sense you expected.

We'll keep you posted.

- Martin

Solomon Yakobson Jan 8 2025

Do you mean it must be enabled on system level and not on session level and all session can do is disabe it for the session?

SY.

MartinBach-Oracle Jan 14 2025

Yes,

that's correct as of Oracle Database Free 23.6.

- Martin

Solomon Yakobson Jan 14 2025

Thanks Martin, I hope this will be added to 23AI docs soon.

SY.

1 - 6

Post Details

Added on Mar 14 2022
0 comments
343 views