Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I have three automatic loading LUA scripts with event.terminate.

When i exit from flight, only first is work other two is not.

What i do wrong?

image.png.ffeb0081049eb5b37b17bce9706327f9.png

image.png.cc39a0ba51eb6d04d31af898df9faf43.png

image.png.6f63dc53083e2d1d25f883a340944ad5.png

Posted

Full log.

 

********* FSUIPC7, Version 7.2.0 (8th June 2021) by John Dowson *********
Checking for FS path in 'C:\Users\Mugz\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\UserCfg.opt'
FS path found = E:\Sim\MSFS2020\
WebSocket server found: C:\Apps\FSUIPC\\Utils\FSUIPCWebSocketServer.exe
Windows 10 Pro 64 Bit reported as Build 19043, Release ID: 2009 (OS 10.0)
Reading options from "C:\Apps\FSUIPC\FSUIPC7.ini"
Checking the Registrations now ...
User Name="Maksim Brykov"
User Addr="mixmugz@gmail.com"
FSUIPC7 Key is provided
WIDEFS7 not user registered, or expired
       93 System time = 14/06/2021 12:32:38
       93 FLT path = "C:\Users\Mugz\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\"
      156 -------------------------------------------------------------------
      171 No hot key defined to open FSUIPC main window - this is ok
      203 FS path = "E:\Sim\MSFS2020\"
      203 ---------------------- Joystick Device Scan -----------------------
      203 Product= R-VPC Stick MT-50CM2
      203    Manufacturer= VIRPIL Controls/20210102
      203    Vendor=3344, Product=4130 (Version 0.1)
      281    GUIDs returned for product: VID_3344&PID_4130:
      281       GUID= {FBB6C6E0-C8A9-11EB-8001-444553540000}
      281       Details: Btns=31, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U16384,V16384,X16384,Y16384,Z16384
      281 Product= VPC Rudder Pedals
      281    Manufacturer= VIRPIL Controls/20210102
      281    Vendor=3344, Product=01F8 (Version 0.1)
      281    GUIDs returned for product: VID_3344&PID_01F8:
      281       GUID= {FBB73C10-C8A9-11EB-8003-444553540000}
      281       Details: Btns=0, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U16384,V0,X0,Y0,Z16384
      281 Product= L-VPC Panel #2
      281    Manufacturer= VIRPIL Controls/20210102
      281    Vendor=3344, Product=825B (Version 0.1)
      281    GUIDs returned for product: VID_3344&PID_825B:
      281       GUID= {33742FA0-C8AA-11EB-8007-444553540000}
      281       Details: Btns=42, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U0,V0,X0,Y0,Z0
      281 Product= L-VPC Throttle MT-50CM3
      296    Manufacturer= VIRPIL Controls/20210102
      296    Vendor=3344, Product=8194 (Version 0.1)
      296    GUIDs returned for product: VID_3344&PID_8194:
      296       GUID= {31F3AA20-C8AA-11EB-8005-444553540000}
      296       Details: Btns=62, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R16384,U16384,V16384,X16384,Y16384,Z16384
      296 -------------------------------------------------------------------
      312 Device acquired for use:
      312    Joystick ID = 0 (Registry okay)
      312    0=RIGHT VPC Stick MT-50CM2
      312    0.GUID={FBB6C6E0-C8A9-11EB-8001-444553540000}
      312 Device acquired for use:
      312    Joystick ID = 1 (Registry okay)
      312    1=VPC Rudder Pedals
      312    1.GUID={FBB73C10-C8A9-11EB-8003-444553540000}
      312 Device acquired for use:
      312    Joystick ID = 3 (Registry okay)
      312    3=LEFT VPC Panel #2
      312    3.GUID={33742FA0-C8AA-11EB-8007-444553540000}
      312 Device acquired for use:
      312    Joystick ID = 2 (Registry okay)
      312    2=LEFT VPC Throttle MT-50CM3
      312    2.GUID={31F3AA20-C8AA-11EB-8005-444553540000}
      312 -------------------------------------------------------------------
      312 ### Note: AI Traffic related facilities and data are inhibited!
      312 LogOptions=00000000 00000001
     3171 Simulator detected
     8218 SimConnect_Open succeeded
     8218 Running in "KittyHawk", Version: 11.0.282174.999 (SimConnect: 11.0.62651.3)
     8218 MSFS version = 11.0.282174.999
     8218 Initialising SimConnect data requests now
    34203 User Aircraft ID not supplied -- trying default
    44046 E:\Sim\MSFS2020\Official\OneStore\asobo-aircraft-pitts\SimObjects\Airplanes\Asobo_Pitts\aircraft.CFG
    46125 Aircraft loaded: running normally now ...
    46500 System time = 14/06/2021 12:33:24, Simulator time = 08:33:22 (09:33Z)
    46515 Aircraft="Pitts Asobo"
    53515 -------------------- Starting everything now ----------------------
    97453 E:\Sim\MSFS2020\Official\OneStore\asobo-aircraft-tbm930\SimObjects\Airplanes\Asobo_TBM930\aircraft.CFG
    97453 Sim stopped: average frame rate for last 51 secs = 157.7 fps
    97453 -------------------------------------------------------------------
    97656   [INFO]: **** Starting FSUIPC7 WASM Interface (WAPI) version 0.5.1
    97656   [INFO]: Connected to MSFS
    97671 LUA.2: ap state: 1
    97687 LUA.1: Init LED state!
    97687 LUA.2: Init LED state!
    97703 LUA.3: Init LED state!
    97906 Lua threads being terminated:
    97906       1 = "C:\Apps\FSUIPC\VPC_LP_#2.lua"
    97906 Waiting for lua threads to process termination event...
    97906 LUA.1: Reseting LED state!
   101093 LUA: "C:\Apps\FSUIPC\VPC_LP_#2.lua": killed
   101359 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   101671 **** DevCom Read thread terminated
   101734       2 = "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua"
   101921 LUA: "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua": killed
   102187 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   102500 **** DevCom Read thread terminated
   102546       3 = "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua"
   102734 LUA: "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua": killed
   103000 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   103312 **** DevCom Read thread terminated
   103375 Aircraft="TBM 930 Asobo"
   103375 C:\Users\Mugz\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\MISSIONS\Custom\CustomFlight\CustomFlight.FLT
   103765 LUA.4: Init LED state!
   103781 LUA.5: ap state: 1
   103796 LUA.6: Init LED state!
   103796 LUA.5: Init LED state!
   106656 #### ERROR: No SimConnect data seen for more than set stall time - will attempt to reconnect...
   106656 **** SimConnect Data Stalled! Re-connecting now ... ****
   106828 SimConnect_Open succeeded
   106828 Running in "KittyHawk", Version: 11.0.282174.999 (SimConnect: 11.0.62651.3)
   106828 MSFS version = 11.0.282174.999
   106828 Initialising SimConnect data requests now
   106828 User Aircraft ID 1 supplied, now being used
   106828 SimObjects\Airplanes\Asobo_TBM930\aircraft.CFG
   106875 User Aircraft ID 1 supplied, now being used
   106953 Waiting for lua threads to process termination event...
   106953 LUA.4: Reseting LED state!
   110140 LUA: "C:\Apps\FSUIPC\VPC_LP_#2.lua": killed
   110390 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   110703 **** DevCom Read thread terminated
   111015 LUA: "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua": killed
   111281 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   111593 **** DevCom Read thread terminated
   111671 LUA.7: Init LED state!
   111734 Waiting for lua threads to process termination event...
   111734 LUA.6: Reseting LED state!
   111781 LUA.8: ap state: 1
   111812 LUA.8: Init LED state!
   114937 LUA: "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua": killed
   115187 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   115500 **** DevCom Read thread terminated
   115625 System time = 14/06/2021 12:34:33, Simulator time = 03:34:18 (09:34Z)
   115671 LUA.9: Init LED state!
   649593 Sim stopped: average frame rate for last 537 secs = 41.1 fps
   649593 -------------------------------------------------------------------
   651953 E:\Sim\MSFS2020\Official\OneStore\asobo-aircraft-tbm930\SimObjects\Airplanes\Asobo_TBM930\aircraft.CFG
   655218 Lua threads being terminated:
   655218       7 = "C:\Apps\FSUIPC\VPC_LP_#2.lua"
   655218 LUA.7: Reseting LED state!
   655234 Waiting for lua threads to process termination event...
   658437 LUA: "C:\Apps\FSUIPC\VPC_LP_#2.lua": killed
   658687 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   658984 **** DevCom Read thread terminated
   659046       8 = "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua"
   659234 LUA: "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua": killed
   659500 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   659812 **** DevCom Read thread terminated
   659875       9 = "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua"
   660062 LUA: "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua": killed
   660328 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   660640 **** DevCom Read thread terminated

 

Posted

Yes, it looks like only one event.terminate function is currently called, for the first lua script that is auto-started.
I will look into it.

However, it is probably better to merge your scripts and just have one event.terminate call anyway. i.e. put all your com handling in a single script, make that the first lua that is auto-started and have your event.terminate call in that script.

You could try the following version. This should call the event.terminate functions for all scripts (but please report back!), but it will only add the TimeForLuaClosing delay to the first event.terminate call. I will look into this further and report back.

FSUIPC7.exe

 

Posted
40 minutes ago, John Dowson said:

However, it is probably better to merge your scripts and just have one event.terminate call anyway.

I dont have idea how to do this, because i have three separated devices with different logic. And i need script to work if some device not accessible.

45 minutes ago, John Dowson said:

This should call the event.terminate functions for all scripts (but please report back!), but it will only add the TimeForLuaClosing delay to the first event.terminate call. I will look into this further and report back.

Firstrun. FSUIPC started, then, after running flight exited without any error in log or something else. Just unloaded from memory.
Second run: FSUIPC started, but LUA scripts not runned even after starting flight
Third run: All started ok, but after exit flight event.terminate work only for first script.

********* FSUIPC7, Version 7.2.1a (14th June 2021) by John Dowson *********
Checking for FS path in 'C:\Users\Mugz\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\UserCfg.opt'
FS path found = E:\Sim\MSFS2020\
WebSocket server found: C:\Apps\FSUIPC\\Utils\FSUIPCWebSocketServer.exe
Windows 10 Pro 64 Bit reported as Build 19043, Release ID: 2009 (OS 10.0)
Reading options from "C:\Apps\FSUIPC\FSUIPC7.ini"
Checking the Registrations now ...
User Name="Maksim Brykov"
User Addr="mixmugz@gmail.com"
FSUIPC7 Key is provided
WIDEFS7 not user registered, or expired
      110 System time = 14/06/2021 15:13:07
      110 FLT path = "C:\Users\Mugz\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\"
      188 -------------------------------------------------------------------
      219 No hot key defined to open FSUIPC main window - this is ok
      235 FS path = "E:\Sim\MSFS2020\"
      235 ---------------------- Joystick Device Scan -----------------------
      235 Product= R-VPC Stick MT-50CM2
      235    Manufacturer= VIRPIL Controls/20210102
      235    Vendor=3344, Product=4130 (Version 0.1)
      313    GUIDs returned for product: VID_3344&PID_4130:
      313       GUID= {FBB6C6E0-C8A9-11EB-8001-444553540000}
      313       Details: Btns=31, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U16384,V16384,X16384,Y16384,Z16384
      313 Product= VPC Rudder Pedals
      313    Manufacturer= VIRPIL Controls/20210102
      313    Vendor=3344, Product=01F8 (Version 0.1)
      313    GUIDs returned for product: VID_3344&PID_01F8:
      313       GUID= {FBB73C10-C8A9-11EB-8003-444553540000}
      313       Details: Btns=0, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U16384,V0,X0,Y0,Z16384
      313 Product= L-VPC Panel #2
      313    Manufacturer= VIRPIL Controls/20210102
      313    Vendor=3344, Product=825B (Version 0.1)
      313    GUIDs returned for product: VID_3344&PID_825B:
      313       GUID= {33742FA0-C8AA-11EB-8007-444553540000}
      313       Details: Btns=42, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R0,U0,V0,X0,Y0,Z0
      313 Product= L-VPC Throttle MT-50CM3
      313    Manufacturer= VIRPIL Controls/20210102
      313    Vendor=3344, Product=8194 (Version 0.1)
      313    GUIDs returned for product: VID_3344&PID_8194:
      313       GUID= {31F3AA20-C8AA-11EB-8005-444553540000}
      313       Details: Btns=62, POVs=(0, 0, 0, 0), Cal=x00000000, Max=R16384,U16384,V16384,X16384,Y16384,Z16384
      313 -------------------------------------------------------------------
      328 Device acquired for use:
      328    Joystick ID = 0 (Registry okay)
      328    0=RIGHT VPC Stick MT-50CM2
      328    0.GUID={FBB6C6E0-C8A9-11EB-8001-444553540000}
      328 Device acquired for use:
      328    Joystick ID = 1 (Registry okay)
      328    1=VPC Rudder Pedals
      328    1.GUID={FBB73C10-C8A9-11EB-8003-444553540000}
      328 Device acquired for use:
      328    Joystick ID = 3 (Registry okay)
      328    3=LEFT VPC Panel #2
      328    3.GUID={33742FA0-C8AA-11EB-8007-444553540000}
      328 Device acquired for use:
      328    Joystick ID = 2 (Registry okay)
      328    2=LEFT VPC Throttle MT-50CM3
      328    2.GUID={31F3AA20-C8AA-11EB-8005-444553540000}
      328 -------------------------------------------------------------------
      344 ### Note: AI Traffic related facilities and data are inhibited!
      344 LogOptions=00000000 00000001
     3219 Simulator detected
     8297 SimConnect_Open succeeded
     8297 Running in "KittyHawk", Version: 11.0.282174.999 (SimConnect: 11.0.62651.3)
     8297 MSFS version = 11.0.282174.999
     8297 Initialising SimConnect data requests now
     8344 C:\Users\Mugz\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\MISSIONS\Custom\CustomFlight\CustomFlight.FLT
     8344 SimObjects\Airplanes\Asobo_TBM930\aircraft.CFG
     8344 User Aircraft ID 1 supplied, now being used
     8438 Aircraft loaded: running normally now ...
     8828 System time = 14/06/2021 15:13:15, Simulator time = 06:13:13 (12:13Z)
     8828 Aircraft="TBM 930 Asobo"
     8938 LUA.1: Init LED state!
     9016   [INFO]: **** Starting FSUIPC7 WASM Interface (WAPI) version 0.5.1
     9032   [INFO]: Connected to MSFS
     9110 LUA.2: Init LED state!
     9110 LUA.3: Init LED state!
    15813 -------------------- Starting everything now ----------------------
    39938 E:\Sim\MSFS2020\Official\OneStore\asobo-aircraft-tbm930\SimObjects\Airplanes\Asobo_TBM930\aircraft.CFG
    46828 Lua threads being terminated:
    46828       1 = "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua"
    46828 LUA.1: Reseting LED state!
    46844 Waiting for lua threads to process termination event...
    49047 LUA: "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua": killed
    49297 **** DevCom read/write threads still running - will exit anyway but could cause issues...
    49610 **** DevCom Read thread terminated
    49672       2 = "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua"
    49875 LUA: "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua": killed
    50110 **** DevCom read/write threads still running - will exit anyway but could cause issues...
    50422 **** DevCom Read thread terminated
    50485       3 = "C:\Apps\FSUIPC\VPC_LP_#2.lua"
    50688 LUA: "C:\Apps\FSUIPC\VPC_LP_#2.lua": killed
    50938 **** DevCom read/write threads still running - will exit anyway but could cause issues...
    51250 **** DevCom Read thread terminated

 

Posted
16 minutes ago, Mugz said:

Firstrun. FSUIPC started, then, after running flight exited without any error in log or something else. Just unloaded from memory.

I don't understand this. Do you mean it crashed? If FSUIPC7 is crashing or not exiring cleanly, I need to see your lkohgs + any windows event information. There is no point in reporting things otherwise.

17 minutes ago, Mugz said:

Second run: FSUIPC started, but LUA scripts not runned even after starting flight

So your lua scripts were not started? Do you have the logs for this?

18 minutes ago, Mugz said:

Third run: All started ok, but after exit flight event.terminate work only for first script.

Ok - as I said, I will look into this.

Posted
1 minute ago, John Dowson said:

I don't understand this. Do you mean it crashed? If FSUIPC7 is crashing or not exiring cleanly, I need to see your lkohgs + any windows event information. There is no point in reporting things otherwise.

There is no any information in log. App Log i can show, but there is a lot error =|

2 minutes ago, John Dowson said:

So your lua scripts were not started? Do you have the logs for this?

Nope, LOG overwrites every time when i start FSUIPC

3 minutes ago, John Dowson said:

Ok - as I said, I will look into this.

A huge thanks for this!

Posted

Additional info.

This error only when i exit from flight to main menu (not from simulator).

Exiting from SIM (Alt+F4) or exitin from FSUIPC by menu File -> Exit work like a charm.

Posted
1 minute ago, Mugz said:

This error only when i exit from flight to main menu (not from simulator).

Sorry, which error?
Do you mean that all  event.terminate functions are called correctly if/when you exit MSFS/FSUIPC7, but not when going back to the main menu?

Posted
1 minute ago, John Dowson said:

Sorry, which error?

I mean event.terminate work correct only if i exit from FSUIPC or MSFS. If i exit from flight to main menu event.terminate work only for first script.

SIM STARTED FLIGHT
	 9281 LUA.1: Init LED state!
     9359   [INFO]: **** Starting FSUIPC7 WASM Interface (WAPI) version 0.5.1
     9359   [INFO]: Connected to MSFS
     9359 System time = 14/06/2021 15:23:53, Simulator time = 06:23:50 (12:23Z)
     9438 LUA.2: Init LED state!
     9453 LUA.3: Init LED state!
    16172 -------------------- Starting everything now ----------------------
   178266 Sim stopped: average frame rate for last 155 secs = 29.1 fps
   178266 -------------------------------------------------------------------
EXIT TO MAIN MENU FROM FLIGHT
   181766 E:\Sim\MSFS2020\Official\OneStore\asobo-aircraft-tbm930\SimObjects\Airplanes\Asobo_TBM930\aircraft.CFG
   188672 Lua threads being terminated:
   188672       1 = "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua"
   188688 Waiting for lua threads to process termination event...
   188688 LUA.1: Reseting LED state!
   190875 LUA: "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua": killed
   191125 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   191438 **** DevCom Read thread terminated
   191500       2 = "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua"
   191703 LUA: "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua": killed
   191953 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   192250 **** DevCom Read thread terminated
   192313       3 = "C:\Apps\FSUIPC\VPC_LP_#2.lua"
   192516 LUA: "C:\Apps\FSUIPC\VPC_LP_#2.lua": killed
   192781 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   193094 **** DevCom Read thread terminated
   985063 Sim stopped: average frame rate for last 799 secs = 65.7 fps
   985063 -------------------------------------------------------------------
   985188 LUA.4: Init LED state!
   985344 LUA.5: Init LED state!
   985359 LUA.6: Init LED state!
  1150938 Sim stopped: average frame rate for last 144 secs = 44.3 fps
  1150938 -------------------------------------------------------------------
  1160828 Lua threads being terminated:
  1160828       4 = "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua"
  1160844 Waiting for lua threads to process termination event...
  1160844 LUA.4: Reseting LED state!
  1163047 LUA: "C:\Apps\FSUIPC\VPC_RCA_MT50CM2.lua": killed
  1163297 **** DevCom read/write threads still running - will exit anyway but could cause issues...
  1163594 **** DevCom Read thread terminated
  1163656       5 = "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua"
  1163859 LUA: "C:\Apps\FSUIPC\VPC_LT_MT50CM3.lua": killed
  1164125 **** DevCom read/write threads still running - will exit anyway but could cause issues...
  1164438 **** DevCom Read thread terminated
  1164500       6 = "C:\Apps\FSUIPC\VPC_LP_#2.lua"
  1164703 LUA: "C:\Apps\FSUIPC\VPC_LP_#2.lua": killed
  1164953 **** DevCom read/write threads still running - will exit anyway but could cause issues...
  1165250 **** DevCom Read thread terminated

 

Posted

As mention in one of you other topics, I have removed the flag that was used to only allow the event.terminate call to be performed once.
I've also attached that version (7.2.1b) here: FSUIPC7.exe

I'm not sure if this is the final solution though, as I think this will add a delay to terminating all lua scripts, event if they do not use event.terminate.
I will look into this further tomorrow.

Posted
4 minutes ago, John Dowson said:

I'm not sure if this is the final solution though, as I think this will add a delay to terminating all lua scripts, event if they do not use event.terminate.
I will look into this further tomorrow.

Yes. Solution is work. I have delay but it's ok for now. You can close topic. 

About crash FSUIPC i need open new topic? Or can you ask for any tasks that I need to do through private messages?

Posted
6 minutes ago, Mugz said:

About crash FSUIPC i need open new topic? Or can you ask for any tasks that I need to do through private messages?

No, I don't provide support via PM, so please raise a new topic.
Please include your FSUIPC7.log file, preferably with Lua Plugin logging enabled if the crash is related to your lua plugins - or does it crash without those running?
Anyway, raise a new topic with all the information you have about the CTD, and I will take a look tomorrow.

Posted
11 minutes ago, Mugz said:

I have delay but it's ok for now. You can close topic. 

Note the delay is specified by this ini parameter (in the [General] section) - you can try reducing if you like:

    TimeForLuaClosing=2
 

Posted
26 minutes ago, John Dowson said:

TimeForLuaClosing=2

It's not help a lot. I set to 0, but only littlebit faster, not instantly.

And ipc.log in terminate function only from first lua.

image.png.6bc4c484a19a241a688da51c699bcb53.png

Posted

I am confused. First you say I can close the topic, then you say the terminate function is only being called once, which means this is not closed and I need to look into it.

I will look into this tomorrow. No point posting again until I have looked into it and can reproduce.

...oh, and please remember, I cannot do anything with pasted log extracts. Always attach your full log, and not just paste log extracts.

  • John Dowson changed the title to event.terminate
Posted

I set up a simple test with 3 luas auto-started, each with an event.terminate function registered that just logs a message when called.
When going from a flight to the main menu, this is what I see logged:

Quote

  ...
  2567750 13184 Lua threads being terminated:
  2567750 13184       6 = "D:\FSUIPC7\terminateTest1.lua"
  2567765 13184 Waiting for lua threads to process termination event....
  2567765 33980 LUA.6: Terminate function called in terminateTest1
  2569953 13184 LUA: "D:\FSUIPC7\terminateTest1.lua": killed
  2569953 13184       7 = "D:\FSUIPC7\terminateTest2.lua"
  2569953   284 LUA.7: Terminate function called in terminateTest2
  2569953 13184 Waiting for lua threads to process termination event....
  2572156 13184 LUA: "D:\FSUIPC7\terminateTest2.lua": killed
  2572156 13184       8 = "D:\FSUIPC7\terminateTest3.lua"
  2572172 34396 LUA.8: Terminate function called in terminateTest3
  2572172 13184 Waiting for lua threads to process termination event....
  2574375 13184 LUA: "D:\FSUIPC7\terminateTest3.lua": killed
  ...

So, the event.terminate function was called in each script, and each thread was killed after TimeForLuaClosing (2 seconds). So this all seems correct to me.

When exiting MSFS from a flight, either from MSFS or from FSUIPC7, I see the following logged:

Quote

  3068953 13184 === About to kill any Lua plug-ins still running ...
  3068969 13184 Waiting for lua threads to process termination event...
  3068969 31172 LUA.9: Terminate function called in terminateTest1
  3068969 10228 LUA.10: Terminate function called in terminateTest2
  3068969 32920 LUA.11: Terminate function called in terminateTest3
  3070375  9000  [ERROR]: Error clearing lvar value data definition with id=11
  3070375  9000  [ERROR]: Error clearing lvar value data definition with id=12
  3070375  9000  [ERROR]: Error clearing lvar data definition with id=9
  3070375  9000  [ERROR]: Error clearing lvar data definition with id=10
  3070375  9000  [ERROR]: Error clearing hvar data definition with id=8
  3070469  9000   [INFO]: SimConnect_Close done
  3070984 13184 Lua threads being terminated:
  3070984 13184       9 = "D:\FSUIPC7\terminateTest1.lua"
  3071172 13184 LUA: "D:\FSUIPC7\terminateTest1.lua": killed
  3071172 13184       10 = "D:\FSUIPC7\terminateTest2.lua"
  3071359 13184 LUA: "D:\FSUIPC7\terminateTest2.lua": killed
  3071359 13184       11 = "D:\FSUIPC7\terminateTest3.lua"
  3071547 13184 LUA: "D:\FSUIPC7\terminateTest3.lua": killed
  3071547 13184 === Closing global Lua thread
 

This log shows that the event.terminate function was again called in each script, but there was only one 2s delay (the TimeForLuaClosing ) before all lua threads were killed.

Note that these tests were done with a slightly modified version (with additional logging) of the 7.2.1b version I posted yesterday, and I am not using the com library, which can take a while to close down successfully. I can add some com handling and repeat my tests if necessary.

So, could you try again with the attached version, and let me know what happens (best to attach your full logs) when you leave a flight to go back to the main menu, and also when in a flight and you exit MSFS/FSUIPC. Thanks.

FSUIPC7.exe

Posted

I've now added com ro my tests, opening it in each of the 3 luas, polling the com in the poll loop, and closing the com connection in the event.terminate function.
This is the log I get when I go from flight back to main menu:

Quote

   ...
   530469 35756 LUA.8: Poll in terminateTest3
   530469 36080 LUA.7: Poll in terminateTest2
   530469  4812 LUA.6: Poll in terminateTest1
   530516 39440 Lua threads being terminated:
   530516 39440       6 = "D:\FSUIPC7\terminateTest1.lua"
   530516  4812 LUA.6: Terminate function called in terminateTest1
   530532 39440 Waiting for lua threads to process termination event....
   530969  4812 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   531282  4812 **** DevCom Read thread terminated
   531344  4812 LUA.6: Com closed in terminateTest1
   532735 39440 LUA: "D:\FSUIPC7\terminateTest1.lua": killed
   532735 39440       7 = "D:\FSUIPC7\terminateTest2.lua"
   532750 39440 Waiting for lua threads to process termination event....
   532750 36080 LUA.7: Terminate function called in terminateTest2
   533203 36080 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   533500 36080 **** DevCom Read thread terminated
   533578 36080 LUA.7: Com closed in terminateTest2
   534938 39440 LUA: "D:\FSUIPC7\terminateTest2.lua": killed
   534953 39440       8 = "D:\FSUIPC7\terminateTest3.lua"
   534953 39440 Waiting for lua threads to process termination event....
   534953 35756 LUA.8: Terminate function called in terminateTest3
   535407 35756 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   535719 35756 **** DevCom Read thread terminated
   535797 35756 LUA.8: Com closed in terminateTest3
   537157 39440 LUA: "D:\FSUIPC7\terminateTest3.lua": killed
   537157 39440 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=N
   ...

And here is the log from exiting MSFS/FSUIPC7 when in a flight:

Quote

   ...
   718141 37468 LUA.9: Poll in terminateTest1
   718141 38856 LUA.10: Poll in terminateTest2
   718188 37320 LUA.11: Poll in terminateTest3
   718328 39440 MSFS no longer running - exiting
   718344 39440 === Hot key unregistered
   718344 39440 === Stop called ...
   718344 39440 === Closing external processes we started ...
   718860 39440 === About to kill any Lua plug-ins still running ...
   718875 37320 LUA.11: Terminate function called in terminateTest3
   718875 37468 LUA.9: Terminate function called in terminateTest1
   718875 39440 Waiting for lua threads to process termination event...
   718875 38856 LUA.10: Terminate function called in terminateTest2
   719188 38780  [ERROR]: Error clearing lvar value data definition with id=20
   719188 38780  [ERROR]: Error clearing lvar value data definition with id=21
   719188 38780  [ERROR]: Error clearing lvar data definition with id=14
   719188 38780  [ERROR]: Error clearing lvar data definition with id=15
   719188 38780  [ERROR]: Error clearing lvar data definition with id=16
   719188 38780  [ERROR]: Error clearing lvar data definition with id=17
   719188 38780  [ERROR]: Error clearing lvar data definition with id=18
   719188 38780  [ERROR]: Error clearing lvar data definition with id=19
   719188 38780  [ERROR]: Error clearing hvar data definition with id=12
   719188 38780  [ERROR]: Error clearing hvar data definition with id=13
   719297 38780   [INFO]: SimConnect_Close done
   719313 37320 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   719313 37468 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   719313 38856 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   719625 37320 **** DevCom Read thread terminated
   719625 38856 **** DevCom Read thread terminated
   719625 37468 **** DevCom Read thread terminated
   719703 37320 LUA.11: Com closed in terminateTest3
   719703 38856 LUA.10: Com closed in terminateTest2
   719703 37468 LUA.9: Com closed in terminateTest1
   720875 39440 Lua threads being terminated:
   720875 39440       9 = "D:\FSUIPC7\terminateTest1.lua"
   721078 39440 LUA: "D:\FSUIPC7\terminateTest1.lua": killed
   721078 39440       10 = "D:\FSUIPC7\terminateTest2.lua"
   721266 39440 LUA: "D:\FSUIPC7\terminateTest2.lua": killed
   721266 39440       11 = "D:\FSUIPC7\terminateTest3.lua"
   721453 39440 LUA: "D:\FSUIPC7\terminateTest3.lua": killed
   721453 39440 === Closing global Lua thread
   ...

So it seems that all the event.terminate functions are being called in all situations.

  • Like 1

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.