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

Error when serializing segment causes invalid message to be sent to the daemon #288

Closed
trossyvormes opened this issue Apr 11, 2021 · 4 comments
Assignees

Comments

@trossyvormes
Copy link

trossyvormes commented Apr 11, 2021

#283 makes Entity.to_dict throw an exception in some cases. When to_dict throws an exception, Entity.serialize returns None:

except Exception:
log.exception("Failed to serialize %s", self.name)

Anyway, the None is put into the message that is sent to the daemon, so the daemon gets {"format":"json","version":1}\nNone, which is an invalid message.

message = "%s%s%s" % (PROTOCOL_HEADER,
PROTOCOL_DELIMITER,
entity.serialize())

I don't think catching everything and returning None in Entity.serialize is a good idea. The exception should continue to be raised and the message send request should be aborted.

See also aws/aws-xray-daemon#120.

@lupengamzn
Copy link
Contributor

Hey @trossyvormes ,

Thank you for pointing this out

We're fixing the Python serialization issue in PR and as for the Daemon issue you mentioned, we figured out that this is an issue introduced in the latest release happened last Friday. We'll do a patch release for both Python SDK and Daemon soon.

Sorry for the inconvenience this brought to you.

@trossyvormes
Copy link
Author

Hey @trossyvormes ,

Thank you for pointing this out

We're fixing the Python serialization issue in PR and as for the Daemon issue you mentioned, we figured out that this is an issue introduced in the latest release happened last Friday. We'll do a patch release for both Python SDK and Daemon soon.

Sorry for the inconvenience this brought to you.

Hello Lu. Fixing the serialization error is a band-aid to the real problem which is that None is returned by Entity.serialize when to_dict fails. If there is a new bug in Entity.to_dict that raises an exception you will get the same bug again. Entity.serialize has to change and not return None when to_dict fails.

@lupengamzn
Copy link
Contributor

@trossyvormes Yes, totally agree that SDK should do the sanity check for this case. Will do a followup PR.

@lupengamzn
Copy link
Contributor

Closing this issue as it's addressed in PR #292

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

No branches or pull requests

2 participants