Skip to content

static file larger than 1MB cause memory leak #619

@yuqiang-yuan

Description

@yuqiang-yuan

I use oak in my project which has both api controllers and static file controllers. I use send from oak to serve static file. I found my server has memory leak issue and after tracking down this issue I find there are many open file descriptors left which opened by Deno process. And the open file descriptors keep increasing when I refresh the page. These files are all larger than 1MB.

I cloned oak code to local and use local copy oak in my project with some debug information added. I found there was destroy method in response.ts and called from application.ts but with closeResources parameter is set to false. I think this is the the key to this issue. Oak use file stream to fulfill response when the static file is larger than 1MB (default maxbuffer) but the file descriptor is left open.

I don't know if I missed something or don't use oak in a right way. Any help will be appreciated.

version information:
deno 1.36.3 (release, aarch64-apple-darwin)
v8 11.6.189.12
typescript 5.1.6
std library: 0.200.0
oak: v12.6.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions