real threads

i have compiled panda3d (a later cvs version) under 10.6 successfully with real threads. i would be really glad if that worked because my project will benefit from massive speedup’s. first it seems to work fine, but i get a assertion error after a few seconds of runtime:

Assertion failed: cdataw->_last_update == cdataw->_next_update at line 4907 of panda/src/pgraph/pandaNode.cxx
Bus error

this is the osx crash-log:
pastebin.be/23285

is there any advice what i could check for if my code is causing the crash, or is this clearly a bug in panda? (it runs quite well with simple_threads, except that it lag’s from time to time and it’s much slower)

Hmm, since I’m not sure what version you’ve compiled, I’m not sure about the line numbers (my code doesn’t have an assertion at line 4907). Still, this looks like an assertion that is designed to detect a race condition while updating the bounding volumes.

This might indeed be caused by a bug in Panda. We don’t often exercise the true-threads build, so there are doubtless a few race conditions in there. If so, one way to work around it would be to ensure that bounding volumes are all computed in the main thread before assigning nodes within the same graph to parallel threads, for instance by computing render.getBounds() under protection of a mutex.

Edit: another thing that might help isolate this would to compile with DEBUG_THREADS, and a lower optimization model, so that the call stack is less mysterious.

David

thanks, i could get around the race conditions by moving the model and texture modifying elements to the main thread. luckily it was only 10 lines i had to modify :slight_smile: