Bdb btree with DB_INIT_CDB crashes on concurrent write

Hi,
I am having issues with bdb and then locking mechanisms.
The following code results in either a seg fault, or what looks like a deadlock/endless loop
#include <iostream>
#include "db_cxx.h"
#include <boost/thread.hpp>
using namespace std;
void thread_instance(Db* db, double start){
double s = start;
double finish = start + 5000;
for(int x=s; x < finish ; x++){
Dbt key(&x, sizeof(double));
Dbt ddata(&x, sizeof(double));
db->put(NULL, &key, &ddata, 0);
int
compare_double(DB dbp, const DBT a,const DBT *b){
double ai, bi;
memcpy(&ai, a->data, sizeof(double));
memcpy(&bi, b->data, sizeof(double));
return (ai > bi ? 1 : ((ai < bi) ? -1 : 0));
int main(){
system("rm data/*");
u_int32_t env_flags = DB_CREATE | DB_INIT_MPOOL | DB_INIT_CDB;
DbEnv* env = new DbEnv(0);
env->set_cachesize(0, 2000000, 1);
u_int32_t m = 0;
env->open("data/", env_flags, 0);
Db* db = new Db(env, 0);
db->set_bt_compare(compare_double);
db->set_flags(DB_DUPSORT);
db->set_pagesize(32768);
db->set_dup_compare(compare_double);
u_int32_t oFlags = DB_CREATE;
try {
db->open(NULL, "db", NULL, DB_BTREE, oFlags, 0);
} catch (DbException &e) {
} catch (std::exception &e) {
vector<boost::thread*> threads;
for(int x=0; x < 3; x++){
threads.push_back(new boost::thread(boost::bind(&thread_instance, db, (x *5000))));
for(int x=0; x < threads.size(); x++){
threads[x]->join();
I have tried DB_INIT_LOCK as well, but with the same results.
What is going on here?

I forgot to include the stack trace:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000019
[Switching to process 34816]
0x00000001002e36a7 in __bamc_put ()
(gdb) ba
#0 0x00000001002e36a7 in __bamc_put ()
#1 0x0000000100386689 in __dbc_iput ()
#2 0x0000000100387a6c in __dbc_put ()
#3 0x0000000100383092 in __db_put ()
#4 0x0000000100397888 in __db_put_pp ()
#5 0x00000001002cee59 in Db::put ()
#6 0x0000000100001f88 in thread_instance (db=0x1007006c0, start=5000) at src/main.cpp:16
#7 0x0000000100698254 in thread_proxy ()
#8 0x00007fff80cb9456 in pthreadstart ()
#9 0x00007fff80cb9309 in thread_start ()

Similar Messages

  • Bdb Btree Freezing

    Hi All,
    I have an interesting issue with bdb Btrees.
    Here is the setup:
    u_int32_t env_flags = DB_CREATE | DB_INIT_MPOOL | DB_INIT_LOCK;
    env = new DbEnv(0);
    env->set_msgfile(berkleyLog);
    env->set_verbose(DB_VERB_DEADLOCK, 1);
    env->open(dir.c_str(), env_flags, 0);
    db = new Db(env, 0);
    db->set_bt_compare(compare_double);
    db->set_flags(DB_DUPSORT);
    db->set_pagesize(pageSize);
    u_int32_t oFlags = DB_CREATE ;
    db->open(NULL, uuid.c_str(), NULL, DB_BTREE, oFlags, 0);
    What is happening is that after inserting about 2000 rows, give or take a few hundred, a call to Db->put deadlocks, and wont return. Cpu load on the box increases to 100%, and from that point on bdb doesnt respond.
    This problem was fixed when using independent db's without the environment by increasing the page size. But, now that I have started using envs, it seems to have crept in again. The data being inserted is double key pairs. My cache size is 200 meg, and I have tried with and without locking. (This particular application doesnt need locking at the moment).
    This issue occurs on version 5.1.19
    Any ideas ? Thanks
    Michael

    Hi Michael,
    Thanks for you're question. I'll do my best to answer, but a complete reproducible test case would make tracking down the issue much easier.
    >
    What is happening is that after inserting about 2000 rows, give or take a few hundred, a call to Db->put deadlocks, and wont return. Cpu load on the box increases to 100%, and from that point on bdb doesnt respond.>
    The behavior you describe matches a hang or infinite loop, rather than a deadlock. In a deadlock the CPU load would generally go to 0.
    Can you debug the application when it is in this state? Could you post a stack trace?
    I notice that you're using a custom key comparison routine. Please post the content of that routine.
    Have you ever killed a process while it's operating on the database that is displaying this behavior? If so, it's possible that the database has been corrupted at some point.
    Could you try running the [url http://download.oracle.com/docs/cd/E17076_02/html/api_reference/C/db_stat.html]db_stat -C A utility on the environment, to see if there are any locks being held that you wouldn't expect?
    Regards,
    Alex Gorrod
    Oracle Berkeley DB

  • Itunes crashes with no crash report and won't let me delete the app...

    If noone can help me I may seriously lose it...
    Mactel user with recent crash issues with itunes...crashes consistently about twenty to thirty seconds after opening and offers no crash report...downloaded appzapper and when I try to empty my trash bin I get the following message which I suspect may have something to do with the crashing:
    The operation cannot be completed becasue the item "ituneshelper" is in use.
    This was happening with 7.0 and now with 7.1...any ideas??
    Thanks in advance!
    20" Mactel   Mac OS X (10.4.6)  

    Look in /Library/Logs for a file named itunes.crash.log.
    IF you see that file, email me a copy, and I'll take a look at it. Please also include a link to this Discussions thread.

  • Firefox wont open, it keeps coming up with the crash report, i've eve restarted the computer, it still isnt working?

    I was just checking my facebook when firefox unexpectedly stopped, then closed down. i clicked back on it and it came up with the crash report. i clicked restart firefox so many times yet it kept coming up with crash report again. i did quit then tried switching the user, logging off and even restarting the computer, all of which failed, and i still have the same problem. internet explorer is working fine. please can anyone help me, i'll be so grateful :) x

    If you get an error that says can't backup, try moving the existing backup file to a safe location and thry again. again. You can find the location of the backup file here:
    iPhone and iPod touch: About backups

  • I have the top of the range MacBook Pro. Yet every time I open iPhoto it grinds to a halt with iPhoto crashing 1 out of every 4 times I open it. Is this normal? And if not how can I fix it?

    I have the top of the range MacBook Pro (but not the latest one with the Retina display). Yet every time I open iPhoto it grinds to a halt with iPhoto crashing 1 out of every 4 times I open it. Is this normal? And if not how can I fix it? I have 55k photo's.

    No it's not normal. What version of iPhoto?  Post the first 50 lines only of the crash report
    Regards
    TD 

  • My previous computer with XP crashed. The new computer is running Windows7 and has a new C: drive. When I installed Firefox on the new C:, I didn't get the old book marks with the install. Where do I find my old bookmarks? Thank you.

    My previous computer with XP crashed. The new computer is Running Windows 7. The two old drives, previously C: (now E:) and G: (now D:) are installed in the new computer. Firefox was installed in the old C: drive (now E:). How do I get the bookmarks from the old C: drive (now E:) to work the the new installation of Firefox on the new computer C: drive?

    See this support article: <br />http://support.mozilla.com/en-US/kb/Recovering+important+data+from+an+old+profile
    Your old Profile is located here in Vista & Win7: <br />
    ''drive'':\Users\''Windows login user name''\AppData\Roaming\Mozilla\Firefox\Profiles\''profile_name''

  • Acrobat Pro 9 with comments crashes

    I'm having problems with consistant crashes from acrobat files marked with comments. They are PDF files that have been sent to several users and commented on.
    Crashes when InDesign CS4 (6.0.2) is open and go back and forth between InDesign and Acrobat Pro 9 (9.1.2). Got a sense that it is related to the comments list or markings on the page. Below is error note from MacOS auto form (OSX 10.5.7):
    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Codes: KERN_INVALID_ADDRESS at 0x00000000c6eb986b
    Crashed Thread:  0
    Any thoughts or processes I should try?
    Thanks.

    thanks for the push to getting a cache cleaner -- tried and will see if it keeps the problem in hand.
    d.

  • My new iMac with FCPX crashes when rendering complex templates and crashes when exporting with Motion 5

    My new iMac with FCPX crashes when rendering complex templates and crashes when exporting with Motion 5
    Using Motion 5.0.6 and Final Cut Pro X 10.0.7 on New iMac (December 2012)  Mountain Lion,
    Intel Core i7 quad-core a 3,4GHz, Turbo Boost fino a 3,9GHz
    32GB di SDRAM DDR3 a 1600MHz - 4 x 8GB
    Fusion Drive da 3TB
    NVIDIA GeForce GTX 680MX 2GB GDDR5
    During the rendering of complex FCPX mac crashes and I have to force a restart.
    I also happens when I try to export movies with Motion 5.
    Does anyone have the same problem with my new iMac?

    Problems such as yours are sometimes caused by files that should belong to you but are locked or have wrong permissions. This procedure will check for such files. It makes no changes and therefore will not, in itself, solve your problem.
    First, empty the Trash.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Triple-click anywhere in the line below to select it, then drag or copy it — do not type — into the Terminal window:
    find . $TMPDIR.. \( -flags +sappnd,schg,uappnd,uchg -o ! -user $UID -o ! -perm -600 -o -acl \) 2> /dev/null | wc -l
    Press return. The command may take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear.
    The output of this command, on a line directly below what you entered, will be a number such as "35." Please post it in a reply.

  • Has anyone had a problem with CS3 crashing after downloading OS 10.8.1 on a imac?

    Has anyone had a problem with CS3 crashing after downloading OS 10.8.1 on a imac? 

    Peggy
    You are probably correct. I tried all different variations to test it. As long as I quit each document separately, i.e., red dot it, I seem to bring up only one document after that whether I click on the document itself or open it within pages. The same is true with numbers.
    Two more questions:
    1) can you turn off the "resume" feature? If so, how? I could not find a way to do it.
    2) why the "save a version" feature in pages? What happened to the old "save" and "save as" features?
    Thanks so much, you saved me a lot of frustration but I am still going to install MS Office for Mac.
    Daveben

  • SCRAMBLE with Friends Crashes?

    Does ANYONE have a problem with SCRAMBLE with friends crashing on your iPod or iPhone?  I've tried contacting Zynga to no avail, and then it hit me . . . could it be that the iOS on the iPod 4G not be strong enough?

    Mine crashes too.  It does not even recognize it on my iPad as a purchased iPad game. It says iPhone game. I don't have a iPhone and I have been playing the game for weeks.  Now I cannot play it and I have games to finish. Have you found a solution to this?

  • My desktop with iTunes crashed, how do i get my music on my phone to the new Itunes on my laptop?

    My desktop with iTunes crashed, how do i get my music on my phone to the new Itunes on my laptop?

    Have you not got a backup of your content on external drives and/or CDs/DVD ? If so then you can copy that onto the computer and load them into iTunes. Have you tried doing File > Transfer Purchases in iTunes with the phone connected to see if any of you purchases transfer over ? If you are in the US then you should also be able to re-download past music purchases : http://support.apple.com/kb/HT2519
    If you havn't bothered backing up your content then you could see if any of the utilities mentioned on this old post still exist and work : https://discussions.apple.com/message/11014893?messageID=11014893#11014893

  • How to use Enqueue/Dequeue to prevent concurrent write?

    Hi All,
    I have a report program that allows multiple users to save to the database tables.
    How do I incorporate ENQUEUE and DEQUEUE statements to prevent concurrent write to ensure data integrity? Are there sample codes that I could refer to?
    Thanks

    Hi,
    here screen get locked
    CALL FUNCTION 'ENQUEUE_EIQMEL'
                   EXPORTING
                        mandt            = sy-mandt
                        qmnum          = i_final_ap-qmnum  -Notification number
                   EXCEPTIONS
                        foreign_lock     = 1
                        system_failure = 2
                        OTHERS         = 3.
    *--Setting the  task "PE03" for notification  on screen
              CALL FUNCTION 'IQS4_ADD_DATA_NOTIFICATION'
                   EXPORTING
                        i_qmnum    = i_final_ap-qmnum
                        i_conv     = ' '
                        i_post     = c_x
                        i_commit   = c_x
                        i_wait     = c_x
                   TABLES
                        i_viqmsm_t = i_viqmsm_tmp
                        return     = i_return.
      CALL FUNCTION 'DEQUEUE_EIQMEL'
                   EXPORTING
                        mandt = sy-mandt
                        qmnum = i_final_ap-qmnum.

  • HT4972 The computer that I normally sync my iphone with has crashed and all info was lost.... Im trying to sync to my new laptop... how do I do this without losing iphone purchases, apps etc???? Help??

    The computer that I normally sync my iphone with has crashed and all info lost.... I'm trying to sync and update with my new laptop but I am getting an error meassage that if I continue all purchases, apps etc will be deleted..... How to I do this without losing all my stuff??? Help I have no clue about technology!!!!!

    The official way to do it is to restore the iTunes library that was on your old computer to your new computer using the backup of your whole system you regularly update.  Then you are syncing the phone with the same old library.
    Some of the information below is summarized by turingtest2 in the post at https://discussions.apple.com/message/18842615
    Your i-device was not designed for unique storage of your media. It is not a backup device and media transfer was designed for you maintaining a master copy of your media on a computer which is itself properly backed up against loss. Syncing is one way, computer to device, updating the device content to the content on the computer, not updating or restoring content on a computer. The exception is iTunes Store purchased content.
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer - http://support.apple.com/kb/HT1848 - only media purchased from iTunes Store
    For transferring other items from an i-device to a computer you will have to use third party commercial software. Examples (check the web for others; this is not an exhaustive listing, nor do I have any idea if they are any good):
    - Senuti - http://www.fadingred.com/senuti/
    - Phoneview - http://www.ecamm.com/mac/phoneview/
    - MusicRescue - http://www.kennettnet.co.uk/products/musicrescue/ - Mac & Windows
    - Sharepod (free) - http://download.cnet.com/SharePod/3000-2141_4-10794489.html?tag=mncol;2 - Windows
    - Snowfox/iMedia - http://www.mac-videoconverter.com/imedia-transfer-mac.html - Mac & PC
    - iexplorer (free) - http://www.macroplant.com/iexplorer/ - Mac&PC
    - Yamipod (free) - http://www.yamipod.com/main/modules/downloads/ - PC, Linux, Mac [Still updated for use on newer devices? No edits to site since 2010.]
    - 2010 Post by Zevoneer: iPod media recovery options - https://discussions.apple.com/message/11624224 - this is an older post and many of the links are also for old posts, so bear this in mind when reading them.
    Syncing to a "New" Computer or replacing a "crashed" Hard Drive - https://discussions.apple.com/docs/DOC-3141 - dates from 2008 and some outdated information now.
    Copying Content from your iPod to your Computer - The Definitive Guide - http://www.ilounge.com/index.php/articles/comments/copying-music-from-ipod-to-co mputer/ - Information about use in disk mode pertains only to older model iPods.
    Get Your Music Off of Your iPod - http://howto.wired.com/wiki/Get_Your_Music_Off_of_Your_iPod - I am not sure but this may only work with some models and not newer Touch, iPhone, or iPad.
    Additional information here https://discussions.apple.com/message/18324797

  • Anyone else having trouble with FCPX crashing after the OSX update?

    Anyone else having trouble with FCPX crashing after the OSX update? It NEVER crashed until the update. The night before last it crashed 20 times in 45 minutes. I can't finish my project because of it.
    Retina, Mid 2012
    Processor  2.3 GHz Intel Core i7
    Memory  8 GB 1600 MHz DDR3
    Graphics  NVIDIA GeForce GT 650M 1024 MB
    Software  OS X 10.9 (13A603)

    therealamaru wrote:
    I don't understand the question. I am simply editing.
    There are some patterns of crashes that suggest possible causes and fixes; some users report crashes when FCPX is in the process of loading; others while importing/exporting, etc. Asking to narrow the list of possibilities.
    Suggest starting with three things:
    1) Update the software from the APp Store  if need be.
    2) Trash preferences.
    3) Repair permissions.
    Russ

  • Please Help me with this crash

    can anybody help me with this crash:
    Host Name: matt-guerins-powerbook-g4-15
    Date/Time: 2008-04-08 10:04:27.426 -0400
    OS Version: 10.4.11 (Build 8S165)
    Report Version: 4
    Command: iCal
    Path: /Users/mattguerin/Library/Application Support/iCal/iCal.app/Contents/MacOS/iCal
    Parent: WindowServer [100]
    Version: 3.0.2 (1236)
    PID: 739
    Thread: Unknown
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/WhitePages.framework/Versions/A/WhitePages
    Referenced from: /Users/mattguerin/Library/Application Support/iCal/iCal.app/Contents/MacOS/iCal
    Reason: image not found

    Pnutbear,
    Welcome to Apple Discussions.
    Use Custom installs in Mac OS X 10.4 to reinstall iCal 2.0.X, and then use the Mac OS X 10.4.11 Combo Update (PPC) to bring iCal to the most recent version for Tiger.
    ;~)

Maybe you are looking for

  • Error in submitting concurrent request

    Hi All, I am getting error while submitting this concurrent request (To handle deliver, RTR, RTV transactions) Error : app-fnd-00874: Routine FDFBDF found no rows in table FND_DESCRIPTIVE_FLEXS. Please contact your system administrator or support rep

  • Flash chart with dynamic sql query does not display

    Hi, In my schema SIVOA I have a lot of tables declared like this :   CREATE TABLE "SIVOA"."EVV_xxxx"    (     "CLEF_VAR" NUMBER(4,0),      "DATE1" DATE,      "VALEUR" NUMBER(16,8) Only the last part of the name changes "xxxx". For example E009, E019,

  • Icon on toolbar is in Korean or other non-English language; help!

    Once in awhile, the icon on the toolbar which lets met know that Firefox is running suddenly changes from English to an Asian language: Chinese? Korean? I don't know what. How do I change it back to English? == This happened == A few times a week ==

  • SAPScript - Adding new radio button

    Hi all, Apparently, my user wants to add additional radio buttons underneath Transaction Code VF31, so that the user can determine which SAPScript form to be printed out using the above appended radio buttons. VF31 will call program SD70AV3A, when ex

  • Slideshow - player controls, fwd, rew, pause

    Wondering why the transport buttons (rew, fwd, pause) on DVD machine don't work with discs created by iDVD? I've tried putting the disc in different players, still can't pause on any of my photos. Also tried checking the box for 'display during slide