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] tapir-vertx-server-zio: Stream response interruption or failure doesn't work when the Content-Length header is set #4207

Open
pentonzxc opened this issue Dec 17, 2024 · 0 comments
Milestone

Comments

@pentonzxc
Copy link

Tapir version: 1.11.10
Scala version: 2.13.15

Describe the bug
When the Content-Length response header is set, the server cannot interrupt a stream if the number of consumed bytes does not match the Content-Length value. Even if the stream fails, it remains uninterruptible.

What is the problem?
The connection hangs indefinitely, with no way to close it on the server side, causing resource leaks. Only the client can terminate the connection.

I think, the server should be able to close a hanging connection if the stream is failed or terminated early, regardless of the Content-Length header.

How to reproduce?

  1. Set the Content-Length response header.
  2. Attempt to timeout or fail a stream using interruptWhen or ZIO.fail(err) and ensure the number of consumed bytes is less than the Content-Length response header value.

Maybe you can provide code to reproduce the problem?

I've created a repository demonstrating the issue:
https://github.com/pentonzxc/tapir-vertx-server-zio-bug-uncancellable-stream.

@pentonzxc pentonzxc changed the title [BUG] Stream response interruption or failure doesn't work when the Content-Length header is set [BUG] tapir-vertx-server-zio: Stream response interruption or failure doesn't work when the Content-Length header is set Dec 17, 2024
@adamw adamw added this to the Next milestone Dec 30, 2024
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