Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch recursive objects during msgpack serialize #51322

Merged
merged 2 commits into from
Jan 25, 2019

Conversation

waynew
Copy link
Contributor

@waynew waynew commented Jan 24, 2019

What does this PR do?

What it says on the tin - catches recursion during payload/msgpack serialization.

What issues does this PR fix or reference?

#37646

Previous Behavior

A return response from a state containing a recursive or cyclical reference, e.g.

bad = {}
bad['news'] = bad

Anywhere in a state response would fail trying to serialize it.

New Behavior

Now the message is serialized, with a <Recursion on ... with id=...> placeholder.

I don't know if there's a better way to do that - repr offers [...] or some such. This follows pprint's style, which is slightly more verbose, so at least when you get the message you might have an idea about what's going on.

Tests written?

Yes

Commits signed with GPG?

Yes

I'm not sure if this is the best way to handle this, but it's definitely
better than blowing up with an exception.

Signed-off-by: Wayne Werner <wwerner@saltstack.com>
@waynew waynew requested a review from a team as a code owner January 24, 2019 22:34
@s0undt3ch s0undt3ch merged commit b76b281 into saltstack:develop Jan 25, 2019
garethgreenaway added a commit to garethgreenaway/salt that referenced this pull request Sep 19, 2019
dwoz added a commit that referenced this pull request Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants