Jump to content
The simFlight Network Forums

COM handling preventing (?) Prepar3D clean shutdown


Recommended Posts

Sorry, I'm not worried about the latency - I understand why that happens. This is the part that is interesting to me:

   112578 LUA.1: Event canceled
   112578 LUA.1: ...ke\Documents\Prepar3D v4 Add-ons\FSUIPC6\cs7x7ap.lua:101
   112578 LUA.1: CS757/767 Button Handler shutdown
   112578 LUA.1: ...ke\Documents\Prepar3D v4 Add-ons\FSUIPC6\cs7x7ap.lua:103
   112578 LUA.1: Waiting for an event in "C:\Users\Luke\Documents\Prepar3D v4 Add-ons\FSUIPC6\cs7x7ap.lua"
   113750 Lua threads being terminated:
   113750       1 = "C:\Users\Luke\Documents\Prepar3D v4 Add-ons\FSUIPC6\cs7x7ap.lua"
   113922 LUA: "C:\Users\Luke\Documents\Prepar3D v4 Add-ons\FSUIPC6\cs7x7ap.lua": killed
   113922 === Closing global Lua thread

By line 103, I've already called event.cancel() so why is it waiting for an event right afterwards?

Cheers

Link to comment
Share on other sites

Note that when you see this: in the log:

Quote

  112203 **** DevCom read/write threads still running - will exit anyway but could cause issues...

This indicates that the thread didn't close correctly, and the initial termination code didn't stop the thread, and so was eventually killed by the main thread (or the DLLStop thread). This can cause issues if the com thread is not fully closed, but I haven't seen such an issue (with the updates in 6.1) so far....

 

Link to comment
Share on other sites

12 minutes ago, Luke Kolin said:

I've already called event.cancel() so why is it waiting for an event right afterwards?

The event.terminate hasn't been cancelled.  Maybe its canellation should be assumed, but as it is all events are treated equally.

Pete

 

Link to comment
Share on other sites

I made some changes and I think I got them all (param, poll, and terminate) but I'm still getting the termination warning. I'm not going to sweat it since it seems to clean up OK. Thanks for your help in understanding the Lua system better.

Cheers!

Link to comment
Share on other sites

4 minutes ago, Luke Kolin said:

Normally. I turned off all of the debug messaging because it was changing the timings too much.

But in normal shutdown, there are only termination messages. The "warnings" are only in your debug log:
   112203 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   112500 **** DevCom Read thread terminated
 

Anyway, I think things are ok as they re for now.... Cheers,

John

Link to comment
Share on other sites

  • 2 weeks later...

So, another interesting data point. I have a key binding set in FSUIPC to restart my LUA scripts which is helpful when debugging and updating them. It just runs LUA <script> which starts it if it has terminated, or kills the existing script if running. Now, it seems to hang P3D... perhaps I'm not cleaning up properly?

here's the log.

Cheers!

 

FSUIPC6.log

Link to comment
Share on other sites

4 hours ago, Luke Kolin said:

So, another interesting data point. I have a key binding set in FSUIPC to restart my LUA scripts which is helpful when debugging and updating them. It just runs LUA <script> which starts it if it has terminated, or kills the existing script if running. Now, it seems to hang P3D... perhaps I'm not cleaning up properly?

It shouldn't hang P3D. But you have errors in the script you should address first:

Quote

   110000 *** LUA Error: ...ke\Documents\Prepar3D v4 Add-ons\FSUIPC6\cs7x7ap.lua:221: attempt to call field 'readShort' (a nil value)
   125453 *** LUA Error: ...ke\Documents\Prepar3D v4 Add-ons\FSUIPC6\cs7x7ap.lua:226: attempt to call field 'readShort' (a nil value)

Also, as I said, could you please activate logging for 'Extras' for such issues, as the thread id is useful. If you correct those errors and still have the same problem, show me the log again (with the Extras logging enabled) as well as the script.

Link to comment
Share on other sites

19 hours ago, John Dowson said:

It shouldn't hang P3D. But you have errors in the script you should address first:

Yes, that's actually why I needed to restart - when debugging to fix silly mistakes like that one. 😄

I'm enclosing two logs. The first is with a hang, the second without. The only difference is again the com.close() - for some reason that is making things unhappy. I don't have a problem keeping it commented out, but the old programmer in me still feels a little unclean at not cleaning things up when I'm done.

(My wife says that doesn't stop me around the house.)

Cheers!

 

FSUIPC6.log FSUIPC6_prev.log

Link to comment
Share on other sites

What is you TimeForLuaClosing set to? I'm not sure where the 'Poll loop stopped' message comes from (can I see your latest version of the lua script please?)
I ask because there doesn't seem to be much of delay between these messages:

Quote

   150031 LUA.1: Poll loop stopped
   150578 LUA: "C:\Users\Luke\Documents\Prepar3D v4 Add-ons\FSUIPC6\cs7x7ap.lua": killed

Maybe there is another section of code that is killing in this situation and i need to add the delay there, I'll check,. But, please activate Extras logging before you show me any more log files. And if your script is changing, its helpful to see that.

Link to comment
Share on other sites

22 minutes ago, John Dowson said:

Maybe there is another section of code that is killing in this situation and i need to add the delay there, I'll check

Yes, there was another section of code that was killing the lua but only had a 100ms delay to wait for the termination procedure to complete. I've changed this to use the TimeForLuaClosing instead, when there is a termination function. Could you try this version please, v6.1.1f: FSUIPC6.dll

Link to comment
Share on other sites

Still a bit strange - not sure why you are still getting the DevCom thread termination messages...

And looks like the 'Extras' logging is not logging the thread info....I thought I had already added that to FSUIPC6, but maybe its only in FSUIPC7. I'll check and add it to FSUIPC6. Helps a lot for this type of thing as there are various threads interacting with lua / devcomms.
Once thats done, I'll do a few more tests here on killing/restarting luas that use coms, but it will probably take a while before I get time for this....

John

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.