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

[BUG] Do not parse interrupted request #4169

Open
akozich opened this issue Nov 14, 2024 · 2 comments · May be fixed by #4214
Open

[BUG] Do not parse interrupted request #4169

akozich opened this issue Nov 14, 2024 · 2 comments · May be fixed by #4214
Assignees

Comments

@akozich
Copy link

akozich commented Nov 14, 2024

Tapir version: 1.11.7

Scala version: 3.5.0

Our endpoint receives the PUT request with JSON body from mobile clients. As mobile network may be unstable some requests are interrupted before receiving the full request body.

We set NettyConfig.requestTimeout to 5s to make sure we close the connection from the server side. Then channel is marked inactive. When org.playframework.netty.HandlerPublisher receives channelInactive it completes by calling SimpleSubscriber.onComplete which sends all received bytes. As a result corrupted JSON is passed to the Codec.

What is the problem?

I'd propose if the number of bytes received is lower than the expected content length do not pass the bytes to the codec

@adamw
Copy link
Member

adamw commented Nov 18, 2024

Yeah this sounds like a bug, I suppose it should call .onError with a timeout exception?

Would you be able to create a PR maybe?

@sergiuszkierat
Copy link
Member

@akozich I've prepared a draft #4214 where I've tried to reproduce the issue. Could you please confirm if that test NettyCatsRequestTimeoutTest shows your scenario?

@sergiuszkierat sergiuszkierat self-assigned this Dec 20, 2024
@sergiuszkierat sergiuszkierat linked a pull request Dec 20, 2024 that will close this issue
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 a pull request may close this issue.

3 participants