Skip to content

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

Closed
@trossyvormes

Description

@trossyvormes

#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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions