Commit 2e671622 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Perform a JS garbage collection for each new request in a reused session

A reused HTTP session would never (apparently) perform garbage collection.
The evidence of this was the collection of concurrent user.dat file opens
that would never close until the HTTP sessions were closed. Hundreds or
even thousands of open user.dat's have been seen. After this change,
active web server (webv4 UI) users have not caused these spikes in open
user.dat files, at least in my testing.

If no garbage collection was being performed, then likely a lot of JS
heap was being needlessly wasted, which could eventually result in a JS
"out of memory" error. But that's just a theory.

Investigation is needed into why the js_CommonOperationCallback()'s calls to
JS_MaybeGC() were not sufficient to actually perform garbage collection
in this case.
parent c1a90b14
Pipeline #3093 passed with stage
in 10 minutes
......@@ -5868,8 +5868,10 @@ static BOOL js_setup_cx(http_session_t* session)
,NULL,NULL,JSPROP_READONLY|JSPROP_ENUMERATE);
JS_ENDREQUEST(session->js_cx);
}
else
else {
JS_BEGINREQUEST(session->js_cx);
JS_MaybeGC(session->js_cx);
}
lprintf(LOG_DEBUG,"%04d JavaScript: Initializing HttpRequest object",session->socket);
if(js_CreateHttpRequestObject(session->js_cx, session->js_glob, session)==NULL) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment