luvit/luvit

"Not enough memory" error or silent failure when exceeding ~2GB RAM (LuaJIT issue?)

Duckwhale opened this issue · 2 comments

According to my research (i.e., Google :D), this is most likely a limitation of LuaJIT itself. However, the latest (2.1-beta) version of LuaJIT doesn't have this problem. I used this script to reproduce the crash: https://gist.github.com/SacredDuckwhale/e912c6b23e6e86bd6a192fc60343a20d

Using Luvit, it will always crash at 1850MB, usually failing silently (this is really bad). Occasionally I was able to get it to print an "not enough memory" error before crashing, but I don't know why that isn't always printed. Using the latest LuaJIT beta release, I can however use all the available memory and no crash will ever occur, even long after I used up all the memory and performance degrades due to disk thrashing.

Can we get this fixed in Luvit, too? I'm not sure how tightly LuaJIT and the Luvit APIs are integrated; but I don't really want to mess with it too much either. I'm mostly using Luvit for the networking library and so that I may use Lua and not JavaScript / NodeJS for my WebSockets-based server application.

PS: I don't plan on using that much memory (for the time being), but having my app silently crash isn't something I'm willing to put up with. I'd much rather have it degrade performance, as is bound to happen when too much data is created, than have the app just die. Since it's a server, you can imagine that'd be a disaster. There are surely ways around using too much memory in the first place, but I'm concerned about future-proofing my app, so I'd rather remove this limitation before it becomes a serious concern.

Luvit should be using LuaJIT 2.1 as of version 2.17.0. See #1098. Are you using an older version?

Well, that was easy. Thanks!

Turns out I only updated luvi and it was still using an old version of luvit. After rebuilding it via lit everything seems to work as expected.