Open soerenmeier opened 2 years ago
This is indeed very unhelpful. I've seen this error too, and as far as I remember, it was caused by the hot-reloading. Are you using the hot-reloading feature by any chance? It would have been fixed in #150, but we decided to not merge it. If you are using the hot-reloading feature, I am afraid that the only workaround right now would be to not use hot-reloading, or to make a local change similar to: https://github.com/DCS-gRPC/rust-server/pull/150/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R168
No, I compiled with cargo build --release
and then copied dcs_grpc.dll and the pdb file to the mods folder.
For the moment i copied the next function and renamed it to try_next and now call that function from next and log::error the Err case.
I can reproduce it now.
While trying to create a small example that reproduces the error to report the issue to mlua
, I've learned that this seems to be caused by DCS' lua.dll
instead. I couldn't reproduce it outside of DCS, and then dropped DCS' lua.dll
into my example, and boom, error was there.
I unfortunately have no idea, why this is caused by DCS' lua.dll
(but I am not surprised either). I've confirmed that DCS runs Lua 5.1.5 and that DCS-gRPC is compiled against exactly this version.
DCS:
DCS-gRPC: https://github.com/DCS-gRPC/rust-server/blob/main/src/lua5.1/include/lua.h#L20
What is strange though, if I download the Lua 5.1.5 release, its dll has clearly a different size (308 KB) compared to the on from DCS (257 KB).
In summary. Not caused by mlua
. Seems to be caused by DCS' lua.dll
. For now, I have no idea how to solve this (except avoiding to return errors from Rust to Lua).
That's weird, probably dcs compiled lua with some special flags or something.
Personally, I would probably just do something like this: https://github.com/soerenmeier/dcs-grpc/commit/7386d9a54e1b841260b8512e8a73f43b5134f85b the errors are always outputted to the dcs-grpc.log
and if the lua version supports it also to lua.
@soerenmeier That is definitely a solution I'd also have in mind 👍. Our only concern in the past was that people tend to look into the dcs.log
file for errors and easily forget that there is also a DCS-gRPC.log
file. I have some ideas of how to pipe them into dcs.log
without having to return them as Lua errors. I'll try to create a POC for that soon.
When deserialization fails in a
next
call this error gets returned from rust: https://github.com/DCS-gRPC/rust-server/blob/4a046556392efc7d17ee9d6c630c3fb3957e1359/src/lib.rs#L151-L158 But in lua only the following line get's outputed:Error retrieving next command: attempt to concatenate a userdata value
. This is very misleading. I tried to debug this but I haven't found anything. Something might be wrong with the lua version of dcs. Did this works once and is this a known issue?mlua: function that passes the error to lua:
callback_error
function that converts the mlua error into a string:init_error_registry