FastRBTree Error

Peter Mell avatarPeter Mell created an issue

Python crashes when using FastRBTree while creating and manipulating large numbers of trees (tens of thousands). It exhibits the same behavior with FastBinaryTree and FastAVLTree but it DOES NOT have the error using RBTree. I've cut down my code to a meaningless 35 line snippet that exhibits the error (see attached). To see the code work correctly, just change line 30 to use RBTree instead of FastRBTree. Lastly, I'm developing on Windows using Python 2.7.3 and bintrees 1.0.3.

This may the the same issue that is already open but just manifesting itself differently. The other issue cites copying trees, which my attached code doesn't do at all.

Comments (6)

  1. Manfred Moitzi

    Hi!

    The error is reproduceable on Win7 Pro x64 and on Linux Mint 15.

    On Linux I got a "Speicherzugriffsfehler" (memory access error).

    Quick Solution: Replace list-key ["test1", "test2"] by tuple-key ("test1", "test2") -> no crash

    I assume: you can't use mutable keys (which is never a good idea) - I use the Python compare function PyObject_RichCompareBool() at C level.

    But i don't know if this is the real problem, because this shouldn't crash Python.

    Let me know if this solves your problems.

    Best regards, Manfred

  2. Peter Mell

    Thanks for the help!! I tried your advice and replaced list-keys with tuple-keys. In my previously attached example code, this does stop Python from crashing. However, when I took the same approach in my actual much larger program, the results were mixed. I now have a more complicated example (while using tuple-keys) that crashes Python when using FastRBTree but not with RBTree. I'll open up a new issue for the new error code although the underlying bugs are probably related.

  3. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.