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

static file larger than 1MB cause memory leak #619

Open
yuqiang-yuan opened this issue Sep 1, 2023 · 2 comments
Open

static file larger than 1MB cause memory leak #619

yuqiang-yuan opened this issue Sep 1, 2023 · 2 comments
Labels
needs investigation Something that needs to be looked at

Comments

@yuqiang-yuan
Copy link

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

@AtomicGamer9523
Copy link

+1

Experiencing same issues. Additionally throws errors when sending large (1.04MB) audio files:

2023-09-04T21:32:07.099Z [ERR] [uncaught application error]: Http - error writing a body to connection: An established connection was aborted by the software in your host machine. (os error 10053): An established connection was aborted by the software in your host machine. (os error 10053)
2023-09-04T21:32:07.100Z [ERR]
    at Object.respondWith (ext:deno_http/01_http.js:328:21)
    at eventLoopTick (ext:core/01_core.js:183:11)
2023-09-04T21:32:07.101Z [ERR] [uncaught application error]: Http - error writing a body to connection: An established connection was aborted by the software in your host machine. (os error 10053): An established connection was aborted by the software in your host machine. (os error 10053)
2023-09-04T21:32:07.103Z [ERR]
request: {
  url: 'http://localhost:8080/assets/music/song.mp3',
  method: 'GET',
  hasBody: false
}
2023-09-04T21:32:07.104Z [ERR] response: { status: 206, type: '.mp3', hasBody: true, writable: false }
2023-09-04T21:32:07.104Z [ERR]
    at Object.respondWith (ext:deno_http/01_http.js:328:21)
    at eventLoopTick (ext:core/01_core.js:183:11)
2023-09-04T21:32:07.104Z [ERR] [uncaught application error]: Http - error writing a body to connection: An established connection was aborted by the software in your host machine. (os error 10053): An established connection was aborted by the software in your host machine. (os error 10053)
2023-09-04T21:32:07.105Z [ERR]
    at async HttpConn.nextRequest (ext:deno_http/01_http.js:101:21)
    at async serve (https://deno.land/x/oak@v12.6.0/http_server_native.ts:112:34)

@NeKzor
Copy link

NeKzor commented Nov 14, 2023

Duplicate of #500.

@kitsonk kitsonk added the needs investigation Something that needs to be looked at label Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation Something that needs to be looked at
Projects
None yet
Development

No branches or pull requests

4 participants