Skip to content
This repository was archived by the owner on Apr 4, 2026. It is now read-only.
This repository was archived by the owner on Apr 4, 2026. It is now read-only.

Don't write to servlet output stream in a trampoline context #223

@jroper

Description

@jroper

As far as I can see, this write:

https://github.com/dlecan/play2-war-plugin/blob/develop/project-code/core/common/src/main/scala/play/core/server/servlet/RequestHandler.scala#L209

and this write:

https://github.com/dlecan/play2-war-plugin/blob/develop/project-code/core/common/src/main/scala/play/core/server/servlet/RequestHandler.scala#L260

Writes to the servlet output stream in a trampoline context, with no consideration of what thread pool the current thread came from. This is incredibly dangerous, since it's a blocking call, and you have no idea which thread pool you're blocking. A single slow reading client could lock up the entire application, preventing it from serving any more requests until that slow client has finished reading everything you sent to it.

Both of these calls should be dispatched to a thread pool, and not the default Play thread pool either, but rather a thread pool that is created specifically for doing blocking IO. That thread pool should be configured by default to have at least 100 threads (the number of threads in that thread pool will be equal to the number of clients can concurrently be downloading responses).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions