You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After doing some investigation I found that the issue happens in the FieldUtils.renderObject call, more specifically when it calls the recurseObject function.
The problem seems to happen because the recurseObject pushes all nodes to a visited list as it traverses them to avoid any cycles, however, it doesn't pop them afterwards, so repeated objects are skipped even if they're not in the same subtree, i.e. there's no circular reference.
As a fix the recurseObject should either pop the visited array before returning, or actually send a copy of the visited nodes in the recursive calls, like [...visited, obj].
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered:
marciocarmona
changed the title
recurseObject skips repeated object references even when they're not causing a cycle
[aws-stepfunctions] recurseObject skips repeated object references even when they're not causing a cycle
May 8, 2021
…t a circular reference (#14628)
Popping the current node from `visited` array after finishing visiting it in `recurseObject` method. This allows another reference to the same object to happen on a different object path (currently being swallowed).
Created unit test before making any code changes to verify the failure scenario on the expected behavior before fixing it.
fixes#14596
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
hollanddd
pushed a commit
to hollanddd/aws-cdk
that referenced
this issue
Aug 26, 2021
…t a circular reference (aws#14628)
Popping the current node from `visited` array after finishing visiting it in `recurseObject` method. This allows another reference to the same object to happen on a different object path (currently being swallowed).
Created unit test before making any code changes to verify the failure scenario on the expected behavior before fixing it.
fixesaws#14596
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
While writing a StepFunction (LambdaInvoke) I noticed part of my input was just missing from the StateMachine step definition.
Reproduction Steps
For example, if I do this:
I get this output:
What did you expect to happen?
It should have returned:
What actually happened?
It returned:
Environment
Other
After doing some investigation I found that the issue happens in the
FieldUtils.renderObject
call, more specifically when it calls therecurseObject
function.The problem seems to happen because the
recurseObject
pushes all nodes to avisited
list as it traverses them to avoid any cycles, however, it doesn't pop them afterwards, so repeated objects are skipped even if they're not in the same subtree, i.e. there's no circular reference.Code reference:
aws-cdk/packages/@aws-cdk/aws-stepfunctions/lib/json-path.ts
Line 89 in 7966f8d
As a fix the
recurseObject
should either pop thevisited
array before returning, or actually send a copy of the visited nodes in the recursive calls, like[...visited, obj]
.This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: