Re: [bdbxml] couldn't open container twice
John Ralls <jralls-qrp8yrQym94Q64ZEkIOog/u6G/[email protected]>
| Newsgroups | gmane.comp.db.dbxml.general |
|---|---|
| Message-ID | <[email protected]> |
On Jul 22, 2005, at 11:19 PM, Dmitriy Kargapolov wrote: > Dmitriy Kargapolov <xoid@...> writes: > > >> >> I tried to open container from two different accounts at the same >> time: >> >> envsContainer = theMgr.openContainer(txn, "test.dbxml", config); >> pause(); >> >> when user1 opened container, user2 couldn't open _same_ container. >> once user1 closed container, user2 went ahead with no further >> problems. >> >> I thought container could be opened multiple times but it didn't >> work. >> >> Did anybody have similar problem? >> Thanks. >> >> ------------------------------------------ >> To remove yourself from this list, send an >> email to xml-unsubscribe@... >> >> >> > > Another consideration: > I ran two identical processes on same db/container. > Each process opens container, performs some modification, then > closes it. > Everything is done with transaction support. > After couple minutes of normal processing both proc. are stuck. > Backtrace in the GDB shows same place where they are waiting: > __db_tas_mutex_lock(): When using multiple processes, you can't use the default db_env. You have to open one explicitly and pass it to the manager. The first process needs to open the environment with DB_INIT_LOCK, DB_INIT_LOG, and DB_INIT_TRANSACTION (and any other flags you think appropriate; I always use DB_RECOVER as well, as it makes things a good deal more robust). Subsequent processes must open the environment with only the DB_JOINENV flag. If you're still having locking issues after doing that, read the section on locking in the DB Programmer's Manual. It's part of the html docs which are included with the DbXml download. Good Luck. Regards, John Ralls