while. This may not fix all cases but should at least solve the issue when rendering with cycles. The cause was a race condition on C->data.recursion, with multiple threads accessing context at the same time. Cycles itself does not access context from the render thread, but the bpy api would do a context update for any callback in case e.g. a new file got loaded. Disabled that now in non-main threads. The ideal solution would be to not allow any context access at all from threads but that's not so simple to implement, especially not this close to release.