Skip to content

High memory usage for needless(?) validation of application/octet-stream #1106

@ellabambasek

Description

@ellabambasek

For ValidateRequestBody the whole body of the request gets loaded into memory via io.ReadAll (1)
The default FileBodyDecoder(2) then also just string()s the data and returns it again

In my application this, and the following validation causes a memory usage if around 10GB when uploading a 1GB file.
From what I can tell ValidateRequestBody doesn't do any useful work on application/octet-stream data(correct me if I'm wrong please)

(1) https://github.com/getkin/kin-openapi/blob/master/openapi3filter/validate_request.go#L269
(2) https://github.com/getkin/kin-openapi/blob/master/openapi3filter/req_resp_decoder.go#L1556

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions