Open LennardF1989 opened 8 years ago
@LennardF1989 How did you load that Lua file in your nginx.conf? Via one of those _by_lua_file
directive or via the Lua builtin function require()
?
@LennardF1989 I've just checked, we do not cache the Lua source code in the code cache but just the compiled Lua/LuaJIT bytecode (for performance reasons). You could dump out the bytecode from one of your running nginx worker processes and use some tool (if any) to convert the bytecode program back to Lua source code.
Yea, I loaded by_lua_file. I don't mind if it's the bytecode! Any idea how I would go about dumping the cached bytecode to a file?
@LennardF1989 Well, you could use gdb to dump out the bytecode. And you could use or customize the tools in the nginx-gdb-utils repo here:
https://github.com/openresty/nginx-gdb-utils
The exact tested gdb command sequence can be a bit long and I don't have the time to prepare and test all this for you. Hopefully I've already got you far enough to figure it out yourself. Good luck!
I accidentally removed a lua-file from my Linux server. Unfortunately the folder in question has fallen outside of my backup routine and as such, I have no backup at all.
OpenResty is still running and functional with the cached LUA as we speak.
Does OpenResty cache the compiled lua file somewhere on the filesystem too, or can I make it dump it from memory? If not, I have a few hours of work ahead of me recreating the file :(