Open yuqiang-yuan opened 1 year ago
+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)
Duplicate of #500.
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 inresponse.ts
and called fromapplication.ts
but withcloseResources
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 (defaultmaxbuffer
) 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