pbrand Posted May 4, 2021 Report Posted May 4, 2021 I hope someone can tell me if I'm doing something wrong, and if so what it is 🙂 I have written some lua scripts for supporting the Honeycomb Bravo throttle. I have included them in the [Auto] section (two files) so they are auto loaded. I start p3d V5.1 with the default Mooney Bravo aircraft. When I then switch to the aircraft I want to use, the A2A C172, p3d crashes. The fsuipc logfile shows the following messages. 167844 Lua threads being terminated: 167844 1 = "D:\FlightSim\FSUIPC6\A2AC172RBravoAnn.lua" 168000 LUA: "D:\FlightSim\FSUIPC6\A2AC172RBravoAnn.lua": killed 168297 **** DevCom read/write threads still running - will exit anyway but could cause issues... 168610 **** DevCom Read thread terminated 168610 LUA.0: Crash C0000005 at 7FFB753F31A7: "" When I repeat the same procedure but with an empty [Auto] section, all is working fine. I can switch to the A2A 172 and p3d does not crash. When I load only one file in [Auto] so either A2AC172RBravoAnn.lua or A2AC172RBravoAp.lua, then all seems to be working fine as well. So it seems to be that the lua scripts themselves do not contain errors? I hope someone can help me in how I can prevent the crash and use the lua scripts in fsuipc to operate correctly? I am of course not sure what the cause of the crash is. I have included the log, fsuipc.ini and the lua files. I hope that is enough info 🙂 Peter Logs_etc.zip
John Dowson Posted May 5, 2021 Report Posted May 5, 2021 Nice lua scripts you have written there! There are sometimes issues closing/killing luas that use the com library. First, could you please try the dll posted recently in this topic, which has a few improvements in this area: Also, check the value of your ini paramater TimeForLuaClosing and maybe increase to 4 or 5. If you still have issues with that, you could add an event.terminate function where you can explicitly close your com connection (com.close).
pbrand Posted May 5, 2021 Author Report Posted May 5, 2021 1 hour ago, John Dowson said: Nice lua scripts you have written there! There are sometimes issues closing/killing luas that use the com library. First, could you please try the dll posted recently in this topic, which has a few improvements in this area: Also, check the value of your ini paramater TimeForLuaClosing and maybe increase to 4 or 5. If you still have issues with that, you could add an event.terminate function where you can explicitly close your com connection (com.close). Thanks for the compliment John 🙂. They are my first attempt at lua (c# developer myself) so not sure if it is 'the lua way' but I try to write maintainable and readable code. I shall try your suggestions tonight and come back with the results. Peter
pbrand Posted May 5, 2021 Author Report Posted May 5, 2021 9 hours ago, John Dowson said: Nice lua scripts you have written there! There are sometimes issues closing/killing luas that use the com library. First, could you please try the dll posted recently in this topic, which has a few improvements in this area: Also, check the value of your ini paramater TimeForLuaClosing and maybe increase to 4 or 5. If you still have issues with that, you could add an event.terminate function where you can explicitly close your com connection (com.close). I have done all three things, John (one by one). Other dll, increased value for TimeForLuaClosing and event.terminate. I no longer see a lua crashed in the log files. But p3d still hangs. I have put some debug message in the terminate function. And I can see that the com.close is called. But the ipc.log after the com.close is not present. Do you have any other things I can try? When I remove the luas from [Auto] it doesn't seem to crash anymore but of course that is not a real solution 😞 Peter A2AC172RBravoAnn.lua A2AC172RBravoAp.lua A2AC172RBravoCommon.lua FSUIPC6.ini FSUIPC6.log
John Dowson Posted May 6, 2021 Report Posted May 6, 2021 (edited) Hi Peter, sorry, but I think you tried the wrong dll - you used 6.1.1a (22nd April), whereas I would like you to try the latest added to that thread, which was 6.1.1f (2nd May). So before I look in detail at your scripts, could you first try that version, and any issues show me your FSUIPC6.log file again please. Just be be sure, here it is again: FSUIPC6.dll 18 hours ago, pbrand said: When I remove the luas from [Auto] it doesn't seem to crash anymore but of course that is not a real solution No, as they are not running then.... 18 hours ago, pbrand said: When I remove the luas from [Auto] it doesn't seem to crash anymore but of course that is not a real solution But if you remove them from the [Auto] section, they aren't running! You should really add them to your [Auto.A2AC172] section - or whatever your A2A profile is called, assuming you have one. If not you should create one and use this. They would then only be started when you load the aorcraft that uses them. Try that dll, but I think there could be various threading/timing issues when starting the lua threads (which then start the coms) then you switch straight away, killing everything to restart. Of course, this is not to say that it shouldn't cause issues killing the scripts and restarting. I will look into this further if needed. John Edited May 6, 2021 by John Dowson Further info added
pbrand Posted May 6, 2021 Author Report Posted May 6, 2021 4 hours ago, John Dowson said: Hi Peter, sorry, but I think you tried the wrong dll - you used 6.1.1a (22nd April), whereas I would like you to try the latest added to that thread, which was 6.1.1f (2nd May). So before I look in detail at your scripts, could you first try that version, and any issues show me your FSUIPC6.log file again please. Just be be sure, here it is again: FSUIPC6.dll 495 kB · 0 downloads No, as they are not running then.... But if you remove them from the [Auto] section, they aren't running! You should really add them to your [Auto.A2AC172] section - or whatever your A2A profile is called, assuming you have one. If not you should create one and use this. They would then only be started when you load the aorcraft that uses them. Try that dll, but I think there could be various threading/timing issues when starting the lua threads (which then start the coms) then you switch straight away, killing everything to restart. Of course, this is not to say that it shouldn't cause issues killing the scripts and restarting. I will look into this further if needed. John Hi John, Sorry, probably missed that latest version of the dll in the thread. I have tried the version you gave me now and it seems that, together with setting TimeForLuaClosing=5 and using event.terminate for com.close, it now works (using only the dll didn't do the trick) 🙂 I have also followed up on your advice concerning a separate profile so now the lua scripts only auto run when the A2A C172 is loaded. I shall perform some more extensive testing to see if the error stays away. Thanks for the help! I will come back to this thread if I have more news after further testing. For now it's looking quite good sofar. Peter
John Dowson Posted May 6, 2021 Report Posted May 6, 2021 Hi Peter, ok, glad its now working (and a bit of a relief!). Thanks for the update. You could also try without the event.terminate, to see if that works in the latest version...or did you try that already? John
pbrand Posted May 6, 2021 Author Report Posted May 6, 2021 14 minutes ago, John Dowson said: Hi Peter, ok, glad its now working (and a bit of a relief!). Thanks for the update. You could also try without the event.terminate, to see if that works in the latest version...or did you try that already? John Yes I tried the following: Only the dll The dll and TimeForLuaClosing=5 The dll and TimeForLuaClosing=5 and event.terminate Only the combination of all three seemed to work.
John Dowson Posted May 6, 2021 Report Posted May 6, 2021 6 minutes ago, pbrand said: Only the combination of all three seemed to work. Ok, good to know, thanks.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now