Hi,
My program is a multithreaded HTTP server that uses lua to process requests.
As part of processing, thre is a snippet of lua code that is processed
local function os_name()
local osname = "???";
local fh, err = assert(io.popen("uname -o 2>/dev/null","r"))
if fh then
osname = fh:read()
end
--io.close(fh);
return (osname);
end
At the end of processing a request the lua_State is closed.
Upon arrival of a new request a new lua_State is opened, and a the set of lua scripts are run again. At this time the program crashes due to override (buffer) on the heap.
As part of request processing, the lua thread is yielded and resumed each time there is some disc or external IO requirement.
Tried this in lua 5.3.5 as well as lua 5.4
I am using Apple M1 macOS 13.1
Darwin Sudheers-MacBook-Pro.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64
Further I am using clang as the compiler for all the build (even lua programs)
Any pointers in this regard will help
Regards,
Sudheer