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

unhelpful crash if response stream is never terminated #2390

Closed
weissi opened this issue Jun 10, 2020 · 3 comments · Fixed by #2404
Closed

unhelpful crash if response stream is never terminated #2390

weissi opened this issue Jun 10, 2020 · 3 comments · Fixed by #2404
Labels
bug Something isn't working
Projects

Comments

@weissi
Copy link
Contributor

weissi commented Jun 10, 2020

Below program which I though would just accept all body bits and never send a response crashes with an unhelpful message (promise leak in HTTPServerHandler).

import Vapor

var env = try Environment.detect()
try LoggingSystem.bootstrap(from: &env)

let app = Application(env)
defer { app.shutdown() }

app.on(.POST, "echo")  { request -> Response in
    return Response(body: .init(stream: { writer in
        request.body.drain { body in
            return request.eventLoop.makeSucceededFuture(())
        }
    }, count: 0))
}

try app.run()

I guess it's totally fair to crash if the user never completes the writer but a message telling the user what they need to do would be good I think.

@Joannis
Copy link
Member

Joannis commented Jun 22, 2020

I assume that this is the same issue as #2389, right?

@weissi
Copy link
Contributor Author

weissi commented Jun 22, 2020

@Joannis I would assume so, unclear if they're exactly the same.

@tanner0101 tanner0101 added the bug Something isn't working label Jun 23, 2020
@tanner0101 tanner0101 added this to To Do in Vapor 4 via automation Jun 23, 2020
@tanner0101
Copy link
Member

Fixed here: 205663c

Vapor 4 automation moved this from To Do to Done Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Vapor 4
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants