Jump to content
The simFlight Network Forums

[AUTO] scripts not ended when going back to the Main Menu


kaha

Recommended Posts

Sometimes lua scripts that reside in the [AUTO] section of the .ini file keep running when the flight is ended and I go back to the Main Menu. This happens since recently only, maybe introduced with version 7.4?

Is there a reason for it?

Link to comment
Share on other sites

10 minutes ago, kaha said:

Is there a reason for it?

I did remove what I thought was some unnecessary code recently with regards to lua script starting/terminating...maybe I removed too much...

I will check this and get back to you.

But you say only sometimes....does this mean that they are usually stopped/killed, but occasionally not? Do you see anything in your logs that indicate that it failed to terminate a lua script?

Link to comment
Share on other sites

18 hours ago, John Dowson said:

I will check this and get back to you.

I have checked this now and all luas are terminated correctly here:

Quote

    56375 LUA.6: **** ipcCessna lua still running....
    58156 LUA.3: **** Auto-test lua still running....
    58375 LUA.6: **** ipcCessna lua still running....
    60156 LUA.3: **** Auto-test lua still running....
    60375 LUA.6: **** ipcCessna lua still running....
    60390 LUA.4: Lights offset 3340 changed: 0
    60750 Killing aircraft lua Autos....
    60750 Lua threads being terminated:
    60750       3 = "D:\FSUIPC7\Lua\luaAutoTest.lua"
    60750 LUA.3: **** Auto-test lua termiated
    60765 Waiting for lua threads to process termination event....
    62969 LUA: "D:\FSUIPC7\Lua\luaAutoTest.lua": killed
    62969       4 = "D:\FSUIPC7\Lua\GFLeds.lua"
    62969 Waiting for lua threads to process termination event....
    65172 LUA: "D:\FSUIPC7\Lua\GFLeds.lua": killed
    65172       5 = "D:\FSUIPC7\Lua\cycleCustomViews.lua"
    65172 Waiting for lua threads to process termination event....
    67359 LUA: "D:\FSUIPC7\Lua\cycleCustomViews.lua": killed
    67359       6 = "D:\FSUIPC7\Lua\ipcCessna.lua"
    67375 LUA.6: **** ipcCessna lua termiated
    67375 Waiting for lua threads to process termination event....
    69562 LUA: "D:\FSUIPC7\Lua\ipcCessna.lua": killed
    69562 Stopping WAPI (as MSFS in main menu)...
    69687   [INFO]: SimConnect_Close done

If your lua scripts are using the com library (or is using any other open handles), then it is a good idea to close these in an event.terminate function, as this can prevent scripts from being terminated.

Otherwise, please show me your FSUIPC7.log and FSUIPC7.ini files when you experience this issue

Link to comment
Share on other sites

John, from this I assume the script that still has open COMs is HIDSwitch.lua and all other scripts don't?

   610765 Killing aircraft lua Autos....
   610765 Lua threads being terminated:
   610765       7 = "C:\FSUIPC7\L_Teensy.lua"
   610781 Waiting for lua threads to process termination event....
   612968 LUA: "C:\FSUIPC7\L_Teensy.lua": killed
   612968       8 = "C:\FSUIPC7\L_Throttle.lua"
   612968 Waiting for lua threads to process termination event....
   615171 LUA: "C:\FSUIPC7\L_Throttle.lua": killed
   615171       9 = "C:\FSUIPC7\L_Mixture.lua"
   615171 Waiting for lua threads to process termination event....
   617359 LUA: "C:\FSUIPC7\L_Mixture.lua": killed
   617359       10 = "C:\FSUIPC7\L_Prop.lua"
   617359 Waiting for lua threads to process termination event....
   619546 LUA: "C:\FSUIPC7\L_Prop.lua": killed
   619546       11 = "C:\FSUIPC7\HIDSwitch.lua"
   619562 Waiting for lua threads to process termination event....
   619984 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   620296 **** DevCom Read thread terminated
   620375 LUA.11: HidSwitch ends.......
   621765 LUA: "C:\FSUIPC7\HIDSwitch.lua": killed
   621765 Stopping WAPI (as MSFS in main menu)...
   621890   [INFO]: SimConnect_Close done

Would you need the .lua script?

FSUIPC7_log.zip

Link to comment
Share on other sites

24 minutes ago, kaha said:

I assume the script that still has open COMs is HIDSwitch.lua and all other scripts don't?

Not necessarily...best to just look at the scripts and see if they are opening any com ports, and if so close them in a terminate function.
However, that log extract shows everything closing/being killed ok.

27 minutes ago, kaha said:

Would you need the .lua script?

Why would i need this? Just check the script and add some lines to close the coms in a terminate event. Looks like it may already have such a function, as 'LUA.11: HidSwitch ends.......' is reported....

 

Link to comment
Share on other sites

6 minutes ago, kaha said:

But why does it report then that there are still open COMs?

It doesn't - it is reporting dev/com threads still running, and this is before the terminate message for that script, so probably not closed yet. I wouldn't worry about this until it fails, i.e. does not stop the script. Then send me the logs.

Link to comment
Share on other sites

1 hour ago, kaha said:

It happened again, here's the log file.

Sorry, but can you point me to what the problem is here? The log file shows everything being closed correctly before exiting:

Quote

 ...
  4228156 MSFS no longer running - exiting
  4228156 === Hot key unregistered
  4228156 === Stop called ...
  4228172 === Closing external processes we started ...
  4228688 === About to kill any Lua plug-ins still running ...
  4228703 Waiting for lua threads to process termination event...
  4229125 **** DevCom read/write threads still running - will exit anyway but could cause issues...
  4229453 **** DevCom Read thread terminated
  4229531 LUA.169: HidSwitch ends.......
  4230719 Lua threads being terminated:
  4230719       165 = "C:\FSUIPC7\L_Teensy.lua"
  4231297 LUA: "C:\FSUIPC7\L_Teensy.lua": killed
  4231297       166 = "C:\FSUIPC7\L_Throttle.lua"
  4231484 LUA: "C:\FSUIPC7\L_Throttle.lua": killed
  4231484       167 = "C:\FSUIPC7\L_Mixture.lua"
  4231672 LUA: "C:\FSUIPC7\L_Mixture.lua": killed
  4231672       168 = "C:\FSUIPC7\L_Prop.lua"
  4231859 LUA: "C:\FSUIPC7\L_Prop.lua": killed
  4231859       169 = "C:\FSUIPC7\HIDSwitch.lua"
  4232047 LUA: "C:\FSUIPC7\HIDSwitch.lua": killed
  4232047 === Closing global Lua thread
 ...

Not sure what us happening here:

Quote

  4140141 Sim stopped: average frame rate for last 79 secs = 29.8 fps
  4140141    Max AI traffic was 6 aircraft
  4140141 -------------------------------------------------------------------
  4140141 Unsubscribed to aircraft Input Events
  4153859 **** Setting font ****
  4153859 Font specified: after dwFont=0x780002 (font=2)
  4153859 Size specified: after dwFont=0xFFE50002 (size=-27.000000)
  4161313 Sim stopped: average frame rate for last 20 secs = 30.4 fps
  4161313    Max AI traffic was 0 aircraft
  4161313 -------------------------------------------------------------------
  4161313 Unsubscribed to aircraft Input Events
  4173719 Lvars received: 1180 L:vars & 0 H:vars now available
  4221656 Sim stopped: average frame rate for last 29 secs = 30.4 fps
  4221656    Max AI traffic was 9 aircraft
  4221656 -------------------------------------------------------------------
  4221656 Unsubscribed to aircraft Input Events
  4222250   [INFO]: SimConnect_Close done

What were you doing? Looks like you are restarting after 79 seconds, then 20 seconds, then again after 29 seconds....
When you start a flight, it can take 1-2 minutes for all data to be received, all threads started and initialised, luas started, etc...it is just not worth me looking intto issues like this, sorry.

Please provide more explanation when you attach a log, and highlighting the issue/timestamp where you think there is a problem.

Also, please note that I have limited time for support at the moment due to personal issues (my wife broke her wrist a few weeks ago, so I have to do all the cooking, cleaning, shopping, dog walking, etc etc) and would appreciate it if you could only report any serious issues for the time being. I can look into strange timing issues when time permits, in a few months maybe...

John

Link to comment
Share on other sites

Also, is this related to the other support issue you have raised with restarting a flight? When you do this, you are NOT going back to the main menu, and I am not sure what FSUIPC does when doing this without checking, i.e. luas may not be restarted. As I said in the other thread, I will check this behavior and see if it needs adjusting.

Link to comment
Share on other sites

Sorry for writing again, John.

It happened again. I made a flight with the Cessna 182RG from Carenado. After landing I went back to the Main Menu in order to change a lua script. Scripts were all ended. I then loded the C182RG again and spent several minutes to check and change button assignments. After that I again went back to the Main Menu and the script was not ended. The timestamp at that time is 11736954.

I then quit the sim and only then the scripts were ended, as the log file shows at time stamp 11903704.

 

ScriptNotEnded.zip

Link to comment
Share on other sites

I will take a look....was an assignments window still open when you went back to the main menu? FSUIPC ignores some events when assignment windows/panels are open, and I was wondering if this could be the cause? I will check here and report back...when I have time. 

John

Link to comment
Share on other sites

Can you please try the attached version which has additional logging. Please activate logging for Extras, and send me the log file when this happens again.
I suspect this issue is related to a timing issue where the plane parking state is received before the new camera state, but the additional logging will confirm this.

Note that if you continue to have such issues, you can set the following in the [General] section of your FSUIPC7.ini file:
    KillLuasOnSimStop=Yes

But don't set this for the time being....

John

FSUIPC7.exe

Edited by John Dowson
attachment updated
Link to comment
Share on other sites

Can you try the attached please:

FSUIPC7.exe

Hopefully this fixes some issues when starting FSUIPC7 (in various sim states), when restarting a flight (note that luas will be left running, not killed), and when exiting a flight and going back to the main menu (luas killed when plane in parking state, regardless of camera state).

John

Link to comment
Share on other sites

1 hour ago, kaha said:

I did intensive testing but scripts always ended ok.

Thanks. I tested quite a but here and released this update as 7.4.3 (including a few ither updates) a few hours ago.

This should/may also fix the other issue you had (a CTD), but please post again in that topic if it occurs again.

Cheers,

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.