annegentle / wadl2rst

Provides a WADL to RST migration tool
Apache License 2.0
2 stars 1 forks source link

server-actions causes infinite loop #52

Closed missaugustina closed 8 years ago

missaugustina commented 8 years ago

It's getting stuck on invert_method.py line 21

missaugustina commented 8 years ago
resources node children 
[<BaseNode name='resource' attributes='{u'path': u'action', u'id': u'action', 'full_path': u'/v2.1/{tenant_id}/servers/{server_id}/action'}'>]
node children [<ParametersNode name='params' attributes='{}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'addFloatingIp'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'addSecurityGroup'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'changePassword'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'confirmResize'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'createImage'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'lock'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'pause'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'reboot'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'rebuild'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'removeFloatingIp'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'removeSecurityGroup'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'rescue'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'resize'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'resume'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'revertResize'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'start'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'stop'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'suspend'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'unlock'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'unpause'}'>, <MethodNode name='method' attributes='{u'name': u'POST', u'id': u'unrescue'}'>]
missaugustina commented 8 years ago

I thought it was hanging but it looks like it's doing something that's increasing memory usage and really slowing it down. I'm gonna guess some kind of recursion is the culprit, but I'm still digging.

https://github.com/sdague/wadl2rst/blob/master/wadl2rst/transformations/invert_method.py#L22

missaugustina commented 8 years ago

I definitely think it's a performance issue, not an infinite loop. I looked at the server-actions wadl and noticed a lot of method nodes. The other files being processed all have about 2-4. The server-actions has 22. The thing I don't know is why we're hitting this now and we weren't before. It could be that something large is being added to the tree before this step and now this step adds it to itself 22 times.

missaugustina commented 8 years ago

Yep that's exactly what's happening... each child node gets an additional 22 child nodes. There's gotta be some circular referencing going on in there too. Anyways, I put a temporary workaround to just check the length of the child_nodes and log the method name that's being skipped so we can compare with the output. I can spend some time diving into specifics of why this method is so horrible later but right now it's just making me dizzy :P

sdague commented 8 years ago

I figured out a work around this morning - https://github.com/annegentle/wadl2rst/commit/018a5c5a84adb0e99d5b8ea23328032baca9132d

missaugustina commented 8 years ago

:+1: