New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua stability #6114
Comments
I get a crash here and there that stacks out to the LUA51 interface... Have you tried luajit or whatever that 'lean' lua manager was called? |
i think i tried that before and there were issues but i'll try again |
still the same problem - but the crash is always an access violation in LuaSupport::CallTestAll(), so apparently it's an invalid pointer somewhere. does anyone have an idea why that might be happening? |
do you have a repeatable crash? you could try to see if the crash is detectable while connected to the DLL |
nah, it's not repeatable. but annoying ... |
i patched out the lua callbacks (for my personal branch) and haven't seen a single crash since. works fine! |
Yeah I think the additional lua callbacks added by whoward in his API were overtaxing stuff. |
civ's lua interface isn't exactly...robust. |
@ilteroi are you gonna push the lua callback opt out? We could lock it behind a define that modders can enable. G |
@ilteroi Hi there :) Anyway which callbacks did you removed or where can I find "your branch"? My first goal is currently a bug free game, so if removing some callbacks might help... Btw. I'm also struggling to build a dll, maybe you have a tip: |
well for building you should follow the guide in VPs readme. the lua switch is in the VP master branch, but callbacks are enabled by default in CP ... search for CORE_DISABLE_LUA_HOOKS in CustomModOptions.xml |
thank you very much, also for your and Gazebos work :) And where can I find the documentation you mentioned? I readme I see a "how to build this" but it is only general information, no step by step nor trouble shooting. I tried it 2 times now, but I can not pass the "fatal error C1083: Cannot open include file: 'unordered_set': No such file or directory" error message from visual studio when trying to build the dll. |
well, i don't really know your setup, but i can tell you that unordered set is part of the visual c++ stl implementation, so you should have it. on my machine it's located at C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include\unordered_set (for VC++ 2008) but each VS release has its own instance. which version are you using? independent of the IDE version, you need to use the legacy 2008 toolset to compile/link the DLL. also, unordered set is only used to store some non-essential advisor messages, you can just as well rip it out and see how far you get without it. |
edit2: edit1: |
good point about the service pack ... anyway, did you manage to attach the visual studio debugger to a running civ game with a custom gamecore dll? anyway if you experience a crash while running in the debugger it shows you where the exception happened. it may be that there is no source available for the crash location, but look at the callstack, if lua51.dll is involved that is a strong hint ... |
found this guide on how to debug https://forums.civfanatics.com/threads/a-guide-to-debugging-crashes-with-a-custom-dll.506328 , I'm able to live debug now, at least break if there is a crash. But I can't set breakpoints myself, nor can I read minidump files (explained in that thread). Anyway, is there no professional way to get a lua traceback, if the crash is caused by lua? Btw: edit: |
|
thanks. sounds good. unfortunately I'm no programmer and and dont know C++ (I'm currently learning by reading civ5 code). Is this something the CP-team will implement? It will also help to track down alot of crashes with CP-mods I guess. edit: what does the stackwalker? Is this already sth for lua? edit2: can you tell me how to read a minidump? I put the minidump in same folder like the dll and the pdb file and opened it with VS. There I see a "dump summary" and a list of modules. But nothing about the crash reason or any code. Where do I see the crash reason in the minidump? (I live debugged, so I know the reason for the crash, but I would like to find it in the dump file too, to learn how to read them). |
i added lua stack logging ... good idea :) |
github is really a strange place, wasnt able to find this topic, neither in closed issues nor in my profile history. Found it via email link. ilteroi: I still have trouble to open minidumps. When I open it, it shows nearly nothing. When hitting "debug with natives" it throws an error about civ5.exe and when I continue I got a break and indeed finally code from that getimprovementtype code. But that did not work for whowards dll, so I'm not sure if this is the supposed way. This specific crash shows C++ code, while other lua crashes only show LUA51. |
i'm getting intermittent crashes from Lua during autoplay, typically in CallTestAll() ... in different hooks. this is annoying and seems impossible to fix, at least for me. does this happen to others as well?
anyway, which of these lua hooks are actually used? i know modders might want to use them, but i would like to disable them by default if we don't need them in base vp. opinions?
The text was updated successfully, but these errors were encountered: