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

UDP message length too long for segments send to daemon #467

Open
DerkSchooltink opened this issue May 24, 2024 · 1 comment
Open

UDP message length too long for segments send to daemon #467

DerkSchooltink opened this issue May 24, 2024 · 1 comment

Comments

@DerkSchooltink
Copy link

I'm getting very frequent error messages such as:

[ERROR] write udp 127.0.0.1:45844->127.0.0.1:2000: write: message too long

I'm running a setup in ECS, where my backend sends Xray traces to a container running in the same task (over UDP). Apparently the segments I'm sending are too large. Although I can probably tweak what I'm sending as part of a segment on my end, I prefer not to sacrifice and context at all; it's very useful for debugging purposes.

I was looking at the way segments are being send:
Emitter and segment packer

It appears that there is no consideration at all for the limitation of UDP packets' max. length of 65535 - 8 - 20 (8 for the UDP header, 20 for the IP header). I think it makes sense to make the SDK aware of this limitation.

I'm not exactly sure how I would go about this, that's why I'm not proposing any solution. Should there be an explicit error returned when this limit is exceeded? Or should the SDK trim part of the segment to make it fit within this limit? I don't know. Let's open up a conversation! :)

@jj22ee
Copy link
Contributor

jj22ee commented Jun 1, 2024

Similar issue in Java SDK - aws/aws-xray-sdk-java#395
Trimming the segment data intelligently would be a technical challenge. The XRay SDK is better to not throw an error if UDP size limit is exceeded to prevent the SDKs from affecting the runtime of the main codebase.

As a workaround in Golang XRay SDK (not particularly a satisfactory workaround), you can create a new Streaming Strategy to limit the number of subsegments per UDP call:

func NewDefaultStreamingStrategyWithMaxSubsegmentCount(maxSubsegmentCount int) (*DefaultStreamingStrategy, error) {
if maxSubsegmentCount <= 0 {
return nil, errors.New("maxSubsegmentCount must be a non-negative integer")
}
c := uint32(maxSubsegmentCount)
return &DefaultStreamingStrategy{MaxSubsegmentCount: c}, nil
}

You can set Streaming Strategy through Config here: https://github.com/aws/aws-xray-sdk-go/blob/master/xray/config.go#L187

If you are able to look into a non-XRay SDK workaround, you can checkout the OpenTelemetry solution at https://opentelemetry.io/, where the SDK and Collector uses http/grpc instead of UDP.

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