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
Just tested the behavior of timeout and memory after running below function 100 times cycled.
Url has 3 minutes delay in response and timeout happens immideately. I thought that appropriate connection will be closed after promise is rejected with TimeoutError and everything will be cleaned. But memory grows. I tried disconnectAll after catching timeout and there is slightly better memory usage after cycle in case of that. All connections stay alive until 3 minutes passed. If we do nearly the same but using AbortController signal cancelling fetches, memory stays constant and there is no any leaks and pending connections.
So the main question is how to clean up connection immideately after timeout?
Under heavy load and under certain conditions, a memory leak will occur.
Experimented to abort after timeouts but no result.
async function fetchTest() {
try {
let newCtx = context();
var response = await newCtx.fetch('https://httpstat.us/200?sleep=180000',{timeout: 10});
}
catch (e) {
console.log(e.constructor.name);
newCtx.disconnectAll(); //consumes less memory with disconnecting after timeot
return {error: e.constructor.name};
}
return { body: await response.text() };
}
The text was updated successfully, but these errors were encountered:
Just tested the behavior of timeout and memory after running below function 100 times cycled.
Url has 3 minutes delay in response and timeout happens immideately. I thought that appropriate connection will be closed after promise is rejected with TimeoutError and everything will be cleaned. But memory grows. I tried disconnectAll after catching timeout and there is slightly better memory usage after cycle in case of that. All connections stay alive until 3 minutes passed. If we do nearly the same but using AbortController signal cancelling fetches, memory stays constant and there is no any leaks and pending connections.
So the main question is how to clean up connection immideately after timeout?
Under heavy load and under certain conditions, a memory leak will occur.
Experimented to abort after timeouts but no result.
The text was updated successfully, but these errors were encountered: