Skip to content

Commit 5a8b250

Browse files
authored
Maintain a ref for the new thread created in net.serve request handling (#252)
With high amounts of requests it seems like the GC is cleaning in-flight threads causing the process to exit. Holding onto a ref is fixing this behavior for me.
1 parent 61f23b0 commit 5a8b250

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/src/net.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ static void processRequest(
238238
)
239239
{
240240
lua_State* L = lua_newthread(state->runtime->GL);
241+
luaL_sandboxthread(L);
242+
std::shared_ptr<Ref> threadRef = getRefForThread(L);
243+
lua_pop(state->runtime->GL, 1);
241244

242245
lua_createtable(L, 0, 5);
243246

0 commit comments

Comments
 (0)