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

Only panic when sending large packets if in debug mode #87

Merged
merged 1 commit into from
Dec 12, 2024

Conversation

caspark
Copy link
Contributor

@caspark caspark commented Dec 12, 2024

What it says on the tin.

I also moved the packet size checking to the UDP socket layer, since technically the thresholds will be different for different network transports.


Also, the original panic-always behavior is super annoying when you tell ggrs your input type is "arbitrary buffer of bytes" and rely on the delta (XOR + run length) encoding to shrink it down, because if your "real" input type has e.g. optional or variable sized data in it (like a vec of positions, or similar), then the delta encoding won't shrink the message below the packet size cut-off - and then on high latency connections with long send queues ggrs will crash.

(That issue could also be improved somewhat by improving the delta encoding: currently delta encoding encodes xors each input against the last confirmed input, but I think it should be possible to delta encode against the last confirmed input N for the input N+1, then for N+2 encode vs N+1, N+3 encodes vs N+2, etc - and ideally factor in custom input prediction too. But that's much more involved than this PR!)

In my personal fork of ggrs, I have actually added logging and I think that's the better approach, but that's a relatively invasive change - so I stuck with the conservative approach here.

And move the packet size checking to the UDP socket layer, since
technically the thresholds will be different for different
network transports.
@caspark caspark force-pushed the large-packets-only-crash-in-debug-mode branch from 5045505 to 8ee4b5e Compare December 12, 2024 09:21
@gschup
Copy link
Owner

gschup commented Dec 12, 2024

Good change!

@gschup gschup merged commit a0f88e0 into gschup:main Dec 12, 2024
2 checks passed
@caspark caspark deleted the large-packets-only-crash-in-debug-mode branch December 12, 2024 10:50
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