Problems with environments and transactional mode in the Python API

Hello everyone,
I have been having problems with the Python API, and I wonder if anyone can comment? I am using DB XML version 2.2.13, with python 2.3 (RedHat linux WS 4.0) and python 2.4 (SuSE 10.1) with identical results. I started with a simple example:
#!/usr/bin/python
"""XPath example from http://www.w3schools.com/xpath/default.asp
ported to DbXML
from bsddb3.db import *
from dbxml import *
books = """<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
  [xml data omitted for brevity]
</bookstore>"""
if __name__ == "__main__":
    conFlags = DB_CREATE | DB_NOMMAP
    myMgr = XmlManager()
    myMgr.setDefaultContainerFlags(conFlags)
    myMgr.setDefaultContainerType( XmlContainer.NodeContainer)
    uc = myMgr.createUpdateContext()
    container = myMgr.createContainer("books.dbxml")
    container.putDocument("books.xml", books, uc)So far, so good - this works, and creates a container books.dbxml that I can open and query. Next, I try to instantiate the XmlManager using an environment:
if __name__ == "__main__":
    envFlags = DB_CREATE | DB_PRIVATE
    conFlags = DB_CREATE | DB_EXCL | DB_NOMMAP
    myEnv = DBEnv()
    myEnv.open("/home/pkeller/dbxml_tests", envFlags, 0)
    myMgr = XmlManager(myEnv, DBXML_ADOPT_DBENV)
    myMgr.setDefaultContainerFlags(conFlags)
    myMgr.setDefaultContainerType( XmlContainer.NodeContainer)
    uc = myMgr.createUpdateContext()
    container = myMgr.createContainer("books.dbxml")
    container.putDocument("books.xml", books, uc)This fails with the following output:
Traceback (most recent call last):
  File "w3school_xpath_c2.py", line 60, in ?
    container = myMgr.createContainer("books.dbxml")
  File "/scratch_bernoulli/pkeller/dbxml/install/lib/python2.3/site-packages/dbxml.py", line 125, in createContainer
    def createContainer(*args): return dbxml.XmlManagercreateContainer(*args)
RuntimeError: Error: Invalid argument
Segmentation faultA bit odd - I can't find anything in the docs about the required arguments to XmlManager.createContainer being different if an environment has been used explicitly.
Anyway, I persevered (my aim being to use transactional mode in Python). Changing the environment and container flags like so:
    envFlags = DB_CREATE  | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_INIT_TXN | DB_PRIVATE
    conFlags = DB_CREATE  | DB_EXCL | DBXML_TRANSACTIONAL | DB_NOMMAPThis change allowed the script to run, outputting the single classic line:
Segmentation fault(the C++ API docs at http://www.sleepycat.com/xmldocs/gsg_xml/cxx/transaction.html#initializetransaction are incorrect by the way - there is no flag DB_TRANSACTIONAL).
In spite of the segfault, the file "books.dbxml" was produced and could be queried by another application. A transaction log file "log.0000000001" was also written (10485760 bytes long).
Running this last example again with "python -v" showed that the segfault was being produced during the python's cleanup phase:
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
Segmentation faultCan anyone clarify what is going on? I had been hoping to deploy DB XML as an alternative to something more admin-heavy, but with this behaviour that would be hard to justify. A dirty exit from Python means that no-one will consider trusting their data to this engine (or am I doing something wrong?).
Regards,
Peter.

Peter,
Your first failure -- invalid argument -- was due to an invalid combination of
flags to DBEnv.open(). Along with DB_CREATE you need at least DB_INIT_MPOOL.
As you can see, it worked once you added more flags.
The second, cleanup problem (segmentation fault) is the result of out of order
destruction of objects. This is fixed in the next release (later this year), but
you can work around it by ensuring that your XmlContainer and XmlManager
objects are deleted/cleaned up before the DBEnv object.
Python will cleanup in reverse order of creation, unless you perform explicit
deletions, which is also fine (e.g. del container, del myMgr).
Explicit deletion is always safe.
Regards,
George

Similar Messages

  • Problem with rotation and landscape mode in iOS 8

    From start of iOS 8 I have got problem with rotation in my iPhone 5S 32GB as well as in my iPad mini retina 32GB. Automatical rotation to landscape mode is not working correctly. For example if you take the phone or tablet to landscape mode in base display and tap to Safari, Mail, Messages, the app will start but stay in normal mode, not landscape. Then you have to back the phone to normal portrait mode and back to landscape and only then the phone do the landscape mode. I have never seen this problem in iOS 7 or older.
    Could you help me anyone with this problem? Or is the problem generally in iOS 8.
    Thanks a lot
    Jakub

    Brian, thanks, but it's not a rotation lock issue - at least not relating to the rotation lock setting. It's just a general use setting. Right now i have my iPhone propped in landscape mode. If I now hit the home button, essentially returning to a portrait setting though my phone is still positioned in landscape, then open any other app that supports landscape, that app WILL NOT orient itself to landscape mode. It will stay in portrait mode. The phone has to be physically oriented to portrait, then back to landscape for the app to register landscape mode properly. This is a glitch, and not a rotation lock issue. it ought to be noted that this was not an issue in iOS 7 or any previous iteration.

  • Having a problem with iTunes and internet radio. The programme keeps changing stations

    I'm abroad at present and using a wireless connection at the lab. Itunes keeps changing internet radio stations as a function of time,
    Any suggestions or os it a known problem with the current version?
    Don

    Try the following user tip:
    "Invalid drive X:\" install errors

  • Problems with Facebook and theater mode

    When a photo is clicked on Facebook, the theater mode appears normally but the original page scrolls up randomly. Is there a fix for this?

    Hannes.S wrote:
    Hi tjk,
    thank you for your reply.
    I will do that, if there is no other solution. I just thought, it'll be better to know what's the problem with my mac...
    But probably you're right, this will be the best solution.
    The repair techs would be the best person to ask that. 

  • Problems with "v", "]", and command keys on the keyboard

    Hi,
    On my MacBook, pressing either the "v" key or the command key to the left of the space bar, without pressing the other one as in a keyboard shortcut, pastes what is currently on my clipboard. Pressing only the command key to the right of the space bar, and not the "]" key in combination, moves me forward in my web browser. When I do press the "]" key, nothing happens (I had to copy and paste the "]" and the "v" for this post). Obviously this is somewhat annoying as typing anything with these two symbols becomes a chore. I am still able to use other keyboard shortcuts, however, but in doing so the command key either pastes from the clipboard or, if I'm using a web browser, moves me to the next page in my history before completing the shortcut. How can I fix this? Thanks.

    Try resetting your SMC.
    Resetting the System Management Controller >>
    Try resetting PRAM:
    1. Shut down the computer.
    2. Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    3. Turn on the computer.
    4. Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
    5. Hold the keys down until the computer restarts and you hear the startup sound (bong) for four times.
    6. Release the keys.
    If neither help, you could have a hardware issue with the keyboard.
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group  iTunes: MacOSG Podcast
    Creator of 'Mac611 - Mobile Mac Support' (designed exclusively for an iPhone/iPod touch)

  • Problem with Role and User Distribution to the SAP System

    Hi to all.
    I've a problem when i try to transfer roles from portal to SAP CRM. (System Administration --> Permissions --> SAP Authorizations).
    If I select from the drop down list the SAP Alias corresponding to the connector to the target system an error is displayed:
    class com.sapportals.connector.connection.ConnectionFailedExceptionConnection Failed: Nested Exception. Failed to get connection. Please contact your admin.
    I think the problem is in the connector configuration since the connector test fails too (due to User attribution problems I think)
    Thank you for any help!

    Hello Mario,
    I have the same problem.
    Did you find a solution for this?
    Please let me know.
    Thanks in advance, Michael

  • I am having a problem with copying and pasting text into the Safari search bar.

    For example, when I copy and paste "Organic Chemistry: A Short Course" it will change to Organic%20Chemistry:%20A%20Short%20Course"
    It will then tell me it has failed to open page, even though my interenet is otherwise working.
    How can I fix this?

    What you tried worked for me. Try "Organic Chemistry -  A Short Course"    It took me to the same search result as what you are trying.

  • Problem with touchpad and Windows 8.1. Acer Aspire E5-511

    I bought an Acer Aspire E5-511, but I have problem with touchpad and Windows 8.1.The touchpad (Synaptics) is not working with Windows 8.1 x64, but it works fine with Windows 7 x64 and Windows 8 x64.When I install Windows 8.1 and have to choose” language to install” I can’t choose anything with the touchpad. I should plug in my mouse to continue. I doesn’t work even when it’s fully installed and with latest driver (available only for win 8.1 x64) from Acer’s website. I tried with an older driver, but had no success. I updated BIOS, but it doesn’t work again. In hardware IDS in device manager it shows HID\… not ACPI\… (like win 7/8). Fn+F7 doesn’t help.When I try to install Windows7/8 the touchpad is working properly at the beginning (I can choose ”language to install”, “Time and currency format”… and the touchpad works after install even without driver).

    SOLUTION So guys after deep research and troubleshooting I found that you need to keep notice of a few things at time of installation: Installation Mode: UEFI (only)- LEGACY would create touchpad issues. after installation of windows just follow the driver installation hierarchy 1.Intel NB_Chipset_M Baytrail-M 2.Intel I/O Driver then rest of the crap. Note:After doing all this make sure your touchpad is active >> Fn+F7 Just wished if this solution came from an acer executive , the world would have been a better place , but anyways this is what community is for. Enjoy everyone

  • Problem with navigation and masthead by changing languages with Anonymous

    Hi All,
    i have a problem with navigation and masthead by changin the language when accessing as anonymous user.
    Ive created two additional users anon_de  (with language german )and anon_en (for english).
    I've created also two links in the in masthead:
    /irj/portal/anonymous?guest_user=anon_en and /irj/portal/anonymous?guest_user=anon_de
    When i choose "de" for the first time it works fine, but when i choose "en" again the language in the content are is changing to english again, but not in navigation and masthead. When i click again on link for "en" the languge is set to english. Strange thing is that when i click on "de" instead the portal content change to german but masthead and navigation are in english now, as it should be before....
    It seems that masthead and navigation have always prevoius language selected.
    Do you know, what could be the reason of that strange behavior?
    Thanks for help
    Karol

    Hi Detlev,
    you are right. the user is not "updated" fast enough... the strange thing is, that it works by the first time i change the language...
    well.. i can implement that workaround as you suposed, but it would be a really workaround as the same page will be requestes second time, causing requests number to be double..
    Thanks for help
    ps. i forgot to mark this message as question to give points.. if you tell me how i can change that ill reward your answer..

  • Problems With Syncing and Audio Play with Itunes

    I've been having a problem with Itunes and my iPhone for the past few days. First of all, iTunes will not play any songs. When I press the play button, the speaker changes to the play picture, and the song loads at the top, but the timer stays stuck on zero. Also, when I attempt to sync my iPhone it will not add new songs downloaded onto my phone. I have updated and re-installed iTunes and it has not helped. Also, tonight I even updated my phone settings (which I interestingly enough was able to do despite the fact that I cant get a song to transfer to my iPhone, yet somehow the new program settings were able to make the jump.)
    I am using Windows Vista at the moment. Does anyone have any idea as to what could be going on? Any help would be greatly appreciated.

    Hi,
    Have you tried backing up you iPhone and copying over everything to iTunes etc.Apps,Videos...Then Restoring to factory setting?
    If that doesn't work try Manually Managing you Music and Videos.

  • I bought a new MacBook Pro several months ago.  I keep losing my wireless connection (my wife, sitting several feet from me has no problem with her iPad2).  I find the quickest fix ix to turn Airport off and back on.  Very annoying.   Suggestions please?

    I bought a new MacBook Pro several months ago.  I keep losing my wireless connection (my wife, sitting several feet from me has no problem with her iPad2).  I find the quickest fix ix to turn Airport off and back on.  Very annoying.   Suggestions please?

    What kind of wireless router are you using? more importantly which protocol are you connecting with? Are you and wife connecting using the 2.4Ghz band? or do you have a dual band router that offers the 5GHZ band?  Are you both connecting vie 802.11 a/b/g or n?
    The best thing to do is to go into SYSTEM PREFERENCES and select NETWORK, then select AIRPORT and click on the ADVANCED button.
    Under the AirPort tab you should delete all the preferred networks and only add back in your network with the proper security settings and passwords.
    If you hold down the option key on your keyboard while clicking on the airport icon at the top on your macbook pro. you'll seesome data that will tell you what band and mode you're connecting at, as well as in an indication of signal strength (RSSI) if you write down and post back that information it'll tell us what's going on.

  • I'm having problems with FlashPlayerPlugin and plugin-container. They keep starting up and bogging down the system. This has been a recent occurrance. I've made sure that I have the latest version. I notice the problem when I am opening some applicatio, a

    I'm having problems with FlashPlayerPlugin and plugin-container. They keep starting up and bogging down the system. This has been a recent occurrance. I've made sure that I have the latest version. I notice the problem when I am opening some applicatio, and it freezes. If I go to Task Manager, I can see the two Adobe apps sucking up CPU cycles. If I end the processes, then the other apps continue. Today, I uninstalled FlashPlayerPluginqand plugin-container. All day since I have had no freezing of an app. What should I do to correct the problem?

    Here's an explanation of what those processes are. 
    Inside Flash Player Protected Mode for Firefox
    I'm curious about what you did to uninstall just those.

  • Have a  problem with Lightroom 5.4.  Since the program crashed yesterday it won't launch, it comes up with the message "Lightroom encountered an error when reading its preview cache and needs to quit".  "  Lightroom will attempt to fix this problem net ti

    Have a  problem with Lightroom 5.4.  Since the program crashed yesterday it won't launch, it comes up with the message "Lightroom encountered an error when reading its preview cache and needs to quit".  "  Lightroom will attempt to fix this problem next time it launches".  Except that it doesn't, I keep getting the same message and the program closes.  Does anyone know what I  can do to repair it?  Can't back up, can't do anything.

    There are dozens of threads in this forum that describe the fix

  • TS5376 I'm having a problem with downloading and installing the new version of itunes for windows (11.1.4)  I have done everything the troubleshooting article has said and it is still not working properly.

    'm having a problem with downloading and installing the new version of itunes for windows (11.1.4)  I have done everything the troubleshooting article has said and it is still not working properly.  I have even done a repair to see if that works and it has not.  Has anyone else found a new way to get it working?

    Try Troubleshooting issues with iTunes for Windows updates.
    tt2

  • Has anyone in this Forum had problems with installing and running Adobe apps on the new MacPro?

    Has anyone in this Forum had problems with installing and running Adobe apps on the new MacPro?
    I have been trying to install Photoshop CS6 & CC and Acrobat Pro XI on my Mac Pro (late 2013). I keep getting a 'configuration' error message and wondered if the problem was wide spread.
    TIA,
    Jerry

    Thanks, Martin.
    Good to hear someone has had success. The lack of it here is frustrating and depressing.
    Thanks again,
    Jerry

Maybe you are looking for