You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
async #handleRequest(request: ServerRequest,secure: boolean,state: RequestState,): Promise<void>{constcontext=newContext(this,request,this.#getContextState(),secure);letresolve: ()=>void;consthandlingPromise=newPromise<void>((res)=>resolve=res);state.handling.add(handlingPromise);if(!state.closing&&!state.closed){try{awaitthis.#getComposed()(context);}catch(err){this.#handleError(context,err);}}if(context.respond===false){context.response.destroy();resolve!();state.handling.delete(handlingPromise);return;}letcloseResources=true;//this is trueletresponse: Response;try{closeResources=false;// this is be modified to false,but no matter it enter catch or not catch,it be modified to false.response=awaitcontext.response.toDomResponse();}catch(err){this.#handleError(context,err);response=awaitcontext.response.toDomResponse();}assert(response);try{awaitrequest.respond(response);}catch(err){this.#handleError(context,err);}finally{context.response.destroy(closeResources);//in there , a lot of file descriptor not be closed by Deno.close(rid);resolve!();state.handling.delete(handlingPromise);if(state.closing){state.server.close();state.closed=true;}}}
check out above comments, see if there has this problems.
I just ran into this bug today. This is not great when you try to build a reliable system just to figure out that things start to break in your production environment. A temporary workaround is to increase the nofiles ulimit. File descriptor exhaustion is a security issue. I don't think anyone would want to run into a DoS attack and a data loss.
Activity
NeKzor commentedon Nov 14, 2023
I just ran into this bug today. This is not great when you try to build a reliable system just to figure out that things start to break in your production environment. A temporary workaround is to increase the nofiles ulimit. File descriptor exhaustion is a security issue. I don't think anyone would want to run into a DoS attack and a data loss.
The code that sets
closeResoucestotrueand then tofalseobviously does not make any sense. Looks like it was overlooked in the commit 5ad9c82#diff-ff7224ffde62f111cc1f7212d7e7da46d90d7258a99ca13c0db39857fbb19a03L390-L394. But one question still remains: When do you ever not close resources? Any insights on this? @kitsonkHere are the steps to reproduce this:
1.) Create a large file of size
MAXBUFFER_DEFAULT2.) Create a
issue_500.tsfile and start the serverdeno run -A issue_500.ts3.) Observe FD leak after visiting
http://127.0.0.1:8000Deno version:
Attempt to fix DoS issue oakserver/oak#500
Fix redirect regression