Blender 2.54 "cyclic" error/warning in console

I’m getting “cyclic” errors or warnings in the console when running my script.

I believe it is something to do with deleting/unlinking objects from the scene.

Is there some simple way of dealing with this, or is it (as i suspect) a really obscure bug that I need to check for?

It doesn’t seem to be a major problem since my script seems to function as expected, but it concerns me since it is a recurrent message to the console that I don’t expect and don’t know how to deal with.

I also get a memory leak report printed to the console when I quit Blender after working on my script. Could the two issues be related?

This issue is apparent in my script as posted in the following thread:
http://blenderartists.org/forum/showthread.php?t=199191

Apply the script to an armature a couple of times and you should get the cyclic message printed to the console and the memory leak report on closing. The more complex the armature you apply the script to, the more console messages you will get.

Hey there, i know it’s a bit late, but i had the same problem. So i just write here how i solved it (i already had a text for asking if somebody know how to solve that, then i solved it on my own in just that minute - lol!) so that in future maybe other people can solve the problem faster. By the way, i had the problem in Blender 2.56, so it is still there.

Well, i had the same cyclic problem with armatures. I created a human model, appending a matching armature as modifier to it. Then i changed something of the model, deleted the armature and the mesh and recreated everything expect of the object of the model.

So as i recreated the armature, i got that cyclic message two times, first while creating the armature, then during linking it as a modifier.

Now the strange thing:
The first time of changing, deleting and recreating, everything worked fine, so i though ok, it’s just a message, but everything is running. But well, after i’ve done that a second time, blender crashed just at the point the first cyclic message occured.

Now the way i solved it:
I think the problem was the deleting. I’ve deleted the object, not the armature itself, and cleared the user before deleting. So as it really deleted the object on a further point, it had (User == -1), well that’s one problem! So no user_clear.
Another problem: I’ve changed the way of deleting. First, i just used the data.objects.remove() function. Later i used the bpy.ops.object.delete() function. I’m no friend of the ops functions, but sometimes it is more simple (mostly i prefer the clean way…). Also i deleted the armature data.

Well, in the end no more cyclic and no crashing blender.

Here’s my final deleting way, which is used before recreating the armature for the same object:


# get armature and data - object means the mesh object
armt = object.modifiers['Skeleton'].object
armt_data = armt.data

# remove armature modifier
object.modifiers.remove(object.modifiers['Skeleton'])

# delete armature
for ob in bpy.data.objects:
    ob.select = 0
armt.select = 1
bpy.context.scene.objects.active = armt
bpy.ops.object.delete()

# delete armature.data - user_clear for armature.data is fine, for the object it might cause problems
armt_data.user_clear()
bpy.data.armatures.remove(armt_data) 

So that’s it, no errors or warnings with that.

Could you explain a little better, seems interesting thing to know and perhaps it is a bug in blender. Could you create a step by step until blender crash?. Like this:

  • Create an object
  • Create an armature
  • Apply the armature as modifier to the object
  • Delete the object
  • … blah blah blah
  • Blender crashes.

I think if blender crashes it must be considered a bug to report. I am very interested in the step by step until blender crashes. Keep it minimal, just a cube and just a bone in the armature or the minimal that creates the crash.

this may have gotten fixed a vouple of days ago by ton. from his twitter :

Fixed material icon updating, tracker slightly op to 58 open. Wednesday we release an update 2.56a because of Undo crash in physics stuff… 12:55 PM Jan 2nd via web

I tried to get the crashing blender problem again, i don’t get it again for the moment. (Hadn’t the time now to work alot on the problem, maybe this afternoon or tomorrow)
In the end, the error was in a 2000 lines script, so it might be happened due to some more complex data adding and deleting, but well after i solved the cyclic thing, it didn’t get any errors anymore, neither blender crashed.

Well, here’s a simple script for the cyclic thing, the more often you call the add and delete function, the more cyclic messages will occur:


import bpy

def armature_add(obj):
    print('Armature add function')
    
    # create armature
    bpy.ops.object.armature_add()
    armt = bpy.context.object
    bones = armt.data.edit_bones
    
    # rename first bone to same name as vertex group
    bpy.ops.object.editmode_toggle()
    bones[0].name = 'bone'
    bpy.ops.object.editmode_toggle()
    
    # add armature as modifier to object
    obj.modifiers.new(name = 'armature', type = 'ARMATURE')
    obj.modifiers['armature'].object = armt

def armature_delete(obj):
    print('Armature delete function')
    
    # get armature
    armt = obj.modifiers['armature'].object
    
    # delete armature
    armt.user_clear()
    bpy.data.objects.remove(armt)

# create mesh and object, link to scene and set active
mesh = bpy.data.meshes.new(name = 'myMesh')
obj = bpy.data.objects.new(name = 'myObj', object_data = mesh)
bpy.context.scene.objects.link(obj)
bpy.context.scene.objects.active = obj

# create vertex group, give it name bone
obj.vertex_groups.new('bone')

# create mesh primitive cube, assign cube to vertex group
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.primitive_cube_add()
bpy.ops.object.vertex_group_set_active(group = 'bone')
bpy.ops.object.vertex_group_assign(new = False)
bpy.ops.object.editmode_toggle()

armature_add(obj)
armature_delete(obj)
# from this point 'cyclic'
armature_add(obj)
armature_delete(obj)
armature_add(obj)
armature_delete(obj)
armature_add(obj)

I think the cyclic occurs due to wrong deleting of the armature, the armature data should be deleted first, then the object, also user_clear() should only be used for the armature data, not the object.

PS: I don’t think that the cyclic problem will be solved with 2.56a, well i’m not sure, but the armature has nothing to do with physic stuff.