Jump to content
The simFlight Network Forums

FSUIPC Lua FSX Crash On Exit


Recommended Posts

Hello,

I would really value any input on a problem I am having with FSUIPC although I'm fairly sure that it is not directly caused by the module.

Firstly, some background. For the past number of years I have been running a slow, but very stable, FSX/Acceleration first on Win-XP and then Win7-64 with very little difficulty and I have developed LUA-based modules to automatically configure hardware interfaces for the aircraft in the simulator.  

However, the time came to update and recently I purchased an i7 system running Win10-64 and have started to replicate my old simulation environment on the new platform.

The installs of FSX/Acceleration and the corresponding SDK went fine. I then installed FSUIPC and transferred my LUA files. Since then, I have been getting constant Crash On Exit errors, ie "A Fatal Error Occurred in FSX etc".  The Windows Event Viewer gives the following:

Faulting application name: fsx.exe, version: 10.0.61637.0, time stamp: 0x46fadb14
Faulting module name: ntdll.dll, version: 10.0.14393.447, time stamp: 0x5819be95
Exception code: 0xc0000005
Fault offset: 0x00026b89
Faulting process ID: 0x21c0
Faulting application start time: 0x01d249c747d4635f
Faulting application path: F:\FSX\fsx.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report ID: a9fa5732-b5ba-11e6-9628-38d547139b07
Faulting package full name:
Faulting package-relative application ID:

For my initial investigation, I reduced one of my LUA modules down to just a few statements displaying a message on the screen (ipc.display) and that works fine. If I then include an event.button() statement I get the crash and if I omit it again, FSX exits correctly.  I've tested for the same result with an event.offset() statement.

In the case of the fault, the log for a short flight looks like this...

FSUIPC4 Key is provided
WIDEFS7 not user registered, or expired
       47 System time = 28/11/2016 23:19:44
       47 FLT path = "...\Documents\Flight Simulator X Files\"
       63 Trying to connect to SimConnect Acc/SP2 Oct07 ...
       63 FS path = "F:\FSX\"
      156 LogOptions=A0000000 00000001
      156 SIM1 Frictions access gained
      156 Wind smoothing fix is fully installed
      156 G3D.DLL fix attempt installed ok
      156 SimConnect_Open succeeded: waiting to check version okay
      156 Trying to use SimConnect Acc/SP2 Oct07
     3266 Running in "Microsoft Flight Simulator X", Version: 10.0.61637.0 (SimConnect: 10.0.61259.0)
     3266 Initialising SimConnect data requests now
     3266 FSUIPC Menu entry added
     3297  ..\Documents\Flight Simulator X Files\Default Initial Test Flight.FLT
     3297 F:\FSX\SimObjects\Airplanes\C172\Cessna172SP.AIR
    10672 *** EVENT: Cntrl= 66514 (0x000103d2), Param= 0 (0x00000000) ATC_MENU_CLOSE
    22641 System time = 28/11/2016 23:20:07, Simulator time = 11:42:41 (19:42Z)
    22641 Aircraft="Cessna Skyhawk 172SP Paint1"
    23641 Starting everything now ...
    23641 LUA.0: beginning "F:\FSX\Modules\ipcReady.lua"
    23641 LUA.0: F:\FSX\Modules\ipcReady.lua:8
    23641 LUA.0: Global: ipcPARAM = 0
    23703 LUA.0: ended "F:\FSX\Modules\ipcReady.lua"
    24860 Advanced Weather Interface Enabled
    27110 LUA.0: beginning "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    27110 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:5
    27110 LUA.0: Global: ipcPARAM = 0
    27156 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:6
    31172 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:10
    31172 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:11
    31172 LUA.0: Global: CH_Fighter_Stick = 4
    31219 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:12
    33235 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:24
    33235 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:19
    33235 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:26
    33235 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    36594 LUA.0: Button event: calling "button_0" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    36594 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:21
    36656 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:22
    36750 *** EVENT: Cntrl= 65588 (0x00010034), Param= 0 (0x00000000) BRAKES
    36844 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:23
    36906 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:24
    36906 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    41766 *** EVENT: Cntrl= 65732 (0x000100c4), Param= 0 (0x00000000) EXIT
    41813 Sim stopped: average frame rate for last 20 secs = 19.8 fps

In the case when I disable just the event.button statement, the log for a similar flight looks like this and FSX exits correctly...

FSUIPC4 Key is provided
WIDEFS7 not user registered, or expired
      109 System time = 28/11/2016 23:23:52
      109 FLT path = "...\Documents\Flight Simulator X Files\"
      125 Trying to connect to SimConnect Acc/SP2 Oct07 ...
      125 FS path = "F:\FSX\"
      218 LogOptions=A0000000 00000001
      218 SIM1 Frictions access gained
      218 Wind smoothing fix is fully installed
      218 G3D.DLL fix attempt installed ok
      218 SimConnect_Open succeeded: waiting to check version okay
      218 Trying to use SimConnect Acc/SP2 Oct07
     3500 Running in "Microsoft Flight Simulator X", Version: 10.0.61637.0 (SimConnect: 10.0.61259.0)
     3500 Initialising SimConnect data requests now
     3500 FSUIPC Menu entry added
     3531 \Documents\Flight Simulator X Files\Default Initial Test Flight.FLT
     3531 F:\FSX\SimObjects\Airplanes\C172\Cessna172SP.AIR
    48718 *** EVENT: Cntrl= 66514 (0x000103d2), Param= 0 (0x00000000) ATC_MENU_CLOSE
    56718 System time = 28/11/2016 23:24:49, Simulator time = 11:42:40 (19:42Z)
    56734 Aircraft="Cessna Skyhawk 172SP Paint1"
    57734 Starting everything now ...
    57734 LUA.0: beginning "F:\FSX\Modules\ipcReady.lua"
    57734 LUA.0: F:\FSX\Modules\ipcReady.lua:8
    57734 LUA.0: Global: ipcPARAM = 0
    57750 LUA.0: ended "F:\FSX\Modules\ipcReady.lua"
    58890 Advanced Weather Interface Enabled
    62703 *** EVENT: Cntrl= 65794 (0x00010102), Param= 0 (0x00000000) PAUSE_ON
    66781 *** EVENT: Cntrl= 65561 (0x00010019), Param= 0 (0x00000000) PAUSE_TOGGLE
    69187 LUA.0: beginning "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    69187 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:5
    69187 LUA.0: Global: ipcPARAM = 0
    69234 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:6
    73250 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:10
    73250 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:11
    73250 LUA.0: Global: CH_Fighter_Stick = 4
    73297 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:12
    75312 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:24
    75312 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:19
    75312 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:24
    75312 LUA.0: ended "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    82656 *** EVENT: Cntrl= 65732 (0x000100c4), Param= 0 (0x00000000) EXIT
    82703 Sim stopped: average frame rate for last 26 secs = 19.9 fps
    88250 System time = 28/11/2016 23:25:21, Simulator time = 11:43:01 (19:43Z)
    88250 *** FSUIPC log file being closed
Average frame rate for running time of 26 secs = 19.9 fps
G3D fix: Passes 10283, Null pointers 0, Bad pointers 0, Separate instances 0
Memory managed: 18 Allocs, 18 Freed
********* FSUIPC Log file closed ***********

 

I have been searching the forums to try and track down anything similar and I think the nearest are perhaps the following but these all relate to P3D...

http://forum.simflight.com/topic/82221-runif1kill-seems-not-to-work-properly-after-update-to-4957b/#comment-496636

http://www.prepar3d.com/forum/viewtopic.php?f=6310&t=122273

http://forum.simflight.com/topic/82312-timeforluaclosing/

I would really appreciate any insights you might have on the issue.

Many thanks for your help,

Best regards,

Mike.

Link to comment
Share on other sites

1 hour ago, SeanMick said:

However, the time came to update and recently I purchased an i7 system running Win10-64 and have started to replicate my old simulation environment on the new platform.

Ouch. 

Just two weeks ago I purchased a new system, much faster than my now 3 year old one, and it too came with Win10-64. I had no end of trouble. Three of my own hardware drivers (not using Lua) kept crashing -- one right at the start, during initialisation. On top of that Prepar3D behaved really bad, sometimes taking 20 seconds to fill in textures even though it was a view seen only a few seconds before. Oddly FSX-SE was fine.

Several of my non-FS related programs crashed periodically, ones which I'd been using reliably for years.

I would have ordered it with Win7 installed, but it wasn't an option from that supplier. I tried to start again, installing Win7 Pro from scratch, but turned out to be impossible without some obscure BIOS changes. The supplier tried to help me in this, but failed, and in any case they said they didn't advise Win7 on that PC and couldn't support me if I changed.

So I returned that one and got my money back and purchased one with an almost identical specification, from a different supplier who did offer it with Win7 or Win10, buyer's choice. That PC is now all set up and performing excellently with no problems at all!

1 hour ago, SeanMick said:

For my initial investigation, I reduced one of my LUA modules down to just a few statements displaying a message on the screen (ipc.display) and that works fine. If I then include an event.button() statement I get the crash and if I omit it again, FSX exits correctly.  I've tested for the same result with an event.offset() statement.

So, with all or any events? With no events outstanding the lua thread would terminate, so any outstanding event will keep it running. FSUIPC tries to terminate it tidily, but that depends a lot on what the lua program has set up in the way of connections. After it has flagged te closure to the lua interpreter, if the thread hasn't terminated itself within a certain time, it is closed forcibly, in the same manner as Task Manager does when you use it to end a process.

One thing I always need in any support request is missing in your report: the version number of FSUIPC. Why remove the startup lines in the Logs? They are important for version numbers, environment and set up.

1 hour ago, SeanMick said:

I have developed LUA-based modules to automatically configure hardware interfaces for the aircraft in the simulator.

What sort of hardware? What sort of interface to it? Do you only mean regular USB joystick type devices, or somnething more complex?

Depending on what version of FSUIPC you are using (make sure you are up to date) you can try the following:

1. Increase the TimeForLuaClosing value in the FSUIPC4.INI file. It defaults to 1 (second).

2. Try to detect closing using the event.terminate function, and use that to tidy up and do an ipc.exit().

3. Add these lines to the INI file [General] section to get extra logging of the termination sequencing in FSUIPC:
Debug=Please
LogExtras=x4

That might give a clearer indication of the stage things are crashing, but since the crash is in ntdll I don't hold out a lot of help. Even with a debugger, whenever I've had any crash in that it is so far nested down in heaps of calls from things I don't even use and am completely unfamiliar with that it's impossible to get anywhere.

Quite honestly, I think Windows 10 is simply incompatible with too many useful programs. I'm sticking to Windows 7, the best platform MS ever did.

Pete

 

Link to comment
Share on other sites

Hi Pete,

Many thanks for your prompt reply.

I too was a very satisfied Win7-64 customer but I intend to move to Prepar3D at some stage soon and decided that since that's in active development I'd go with the latest OS version for future-proofing... bad call on my part it seems!

My apologies for not including the FSUIPC version details.  I have tried both 9.958 and Version 9.934 which I used under Win7 and I have had the same crash-on-exit events in both cases.

I am interfacing to simple USB based hardware, CH Product devices and Leo Bodnar controllers.

I have the additional lines you suggested added to my FSUIPC ini file.

In the last while I assigned a joystick button to LuaKillAll and I have found that invoking this prior to quitting FSX results in a clean exit from the sim.

Moving on from that, I tried your suggestion regarding using event.terminate to call ipc.exit and this has solved the problem I think in that I now get a graceful exit with the usual panel asking me to confirm my exit from FSX.

I am including below the last few lines of the log files in all of these cases if they are of any help,  I'd really like to understand why this termination code is required now and not in my previous system.


WITHOUT INVOKING LuaKillAll...
    42765 LUA.0: Button event: calling "button_0" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    42765 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:21
    42828 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:22
    42984 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:23
    43000 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:24
    43000 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    52047 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
    52047 Sim stopped: average frame rate for last 29 secs = 29.8 fps
    52047              Max AI traffic was 15 aircraft
    55890 === DLLStop called ...


INVOKING LuaKillAll...
    48703 LUA.0: Button event: calling "button_0" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    48703 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:21
    48765 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:22
    48921 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:23
    48937 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:24
    48953 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    55781 LUA.0: ended "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    61875 Memory in use: 981Mb, Avail=3115Mb
    63328 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
    63328 Sim stopped: average frame rate for last 41 secs = 29.8 fps
    63328              Max AI traffic was 16 aircraft
    67812 === DLLStop called ...
    67812 === About to kill my timers ...
    68015 === Restoring window procs ...
    68015 === Unloading libraries ...
    68031 === stopping other threads ...
    68234 === NOTE: not calling SimConnect_Close ...
    68234 === AI slots deleted!
    68234 === Freeing button memory ...
    68234 === Closing my Windows ...
    68234 === Freeing FS libraries ...
    69234 === Closing devices ...
    69234 === Closing the Log ... Bye Bye! ...
    69234 System time = 29/11/2016 14:43:39, Simulator time = 14:43:14 (22:43Z)
    69250 *** FSUIPC log file being closed
Minimum frame rate was 28.7 fps, Maximum was 30.0 fps
Minimum available memory recorded was 3113Mb
Average frame rate for running time of 41 secs = 29.8 fps
G3D fix: Passes 10412, Null pointers 0, Bad pointers 0, Separate instances 0
Maximum AI traffic for session was 16 aircraft
Memory managed: 26 Allocs, 26 Freed
********* FSUIPC Log file closed ***********


WITH event.terminate/ipc.exit CODE ADDED
    37157 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:240
    37172 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:244
    37172 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    48157 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
    48157 Sim stopped: average frame rate for last 30 secs = 29.9 fps
    48157              Max AI traffic was 23 aircraft
    52719 === DLLStop called ...
    52719 LUA.0: Terminate event: calling "exit_strategy" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    52719 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:1499
    53000 === About to kill my timers ...
    53203 === Restoring window procs ...
    53203 === Unloading libraries ...
    53203 === stopping other threads ...
    53407 === NOTE: not calling SimConnect_Close ...
    53407 === AI slots deleted!
    53407 === Freeing button memory ...
    53407 === Closing my Windows ...
    53407 === Freeing FS libraries ...
    54407 === Closing devices ...
    54407 === Closing the Log ... Bye Bye! ...
    54422 System time = 29/11/2016 16:16:21, Simulator time = 16:15:59 (00:15Z)
    54422 *** FSUIPC log file being closed
Minimum frame rate was 29.4 fps, Maximum was 30.0 fps
Minimum available memory recorded was 3087Mb
Average frame rate for running time of 30 secs = 29.9 fps
G3D fix: Passes 10425, Null pointers 0, Bad pointers 0, Separate instances 0
Maximum AI traffic for session was 23 aircraft
Memory managed: 86 Allocs, 86 Freed
********* FSUIPC Log file closed ***********


It looks like this is a solution to my problem so many many thanks for your help and great support.

I will add this terminating event to all of my lua control files and hopefully I can now move on to the next install issue, ie the next of very very many I suspect!  I know now why I kept my last FSX machine for so long!!!

Let me know if you would like me to do any further investigation.

Best regards,

Mike.

Link to comment
Share on other sites

17 minutes ago, SeanMick said:

I am including below the last few lines of the log files in all of these cases if they are of any help,  I'd really like to understand why this termination code is required now and not in my previous system.

Well, not much to derive really. The interesting log is the first which shows the crash occurring right at the start of the termination process, soon after DLLstop is called by SimConnect. That's when the signal to lua threads to terminate is sent. So it's something to do with one or other of the things running or instigated in your lua plug=ins. Since I've no idea what they do I can't really comment further on tht.

20 minutes ago, SeanMick said:

I am interfacing to simple USB based hardware, CH Product devices and Leo Bodnar controllers.

Using normal Lua library functions only, or some external drivers?

22 minutes ago, SeanMick said:

I assigned a joystick button to LuaKillAll and I have found that invoking this prior to quitting FSX results in a clean exit from the sim.

Interesting that the more ruthless method has the good result. I would have thought allowing the plug-ins to terminate tidily would be more likely to give a better result. However, that is interesting and maybe useful. In the current version of FSUIPC setting "TimeForLuaClose=0" would result in the default of 1 second in any case. I'm changing that so that setting it to 0 will immediately and ruthlessly terminate all plug-ins on session end, same as you doing a "LuaKillAll".

Perhaps you could test it for me to see if it has the same effect. Please do it with that logging enabled and show me the log so I can see that it worked okay.

The modified version is 4.958g, download link: FSUIPC4958g.zip

That's only the FSUIPC4.DLL file. Just copy it into your FS Modules folder.

42 minutes ago, SeanMick said:

I will add this terminating event to all of my lua control files

That's definitely the tidiest solution (in the sense of "being kind to lua plug-ins") ;-)

Pete

 

Link to comment
Share on other sites

Hi Pete,

I have repeated the tests I ran earlier and hopefully have included your requests. I have set TimeForLuaClosing=5 in all of these, as it was in the previous tests I sent you.

That's when the signal to lua threads to terminate is sent. So it's something to do with one or other of the things running or instigated in your lua plug=ins. Since I've no idea what they do I can't really comment further on tht. 

Using normal Lua library functions only, or some external drivers?

 

The Lua test file is very simple, as given below.  I comment out the event.terminate() call depending on the test.

 

-- A Lua plugin to set controller buttons.

-- Define the controllers
CH_Fighter_Stick = 4
ipc.display("Default Cessna C172 Controllers defined! ",2)
ipc.sleep(2000)

-- BUTTON 0: Parking Brake
 function button_0 ( )
        ipc.keypressplus(190)
        ipc.display("Testing button 0... Brakes ",2)        
end
-- Button 0 event trapping
event.button(CH_Fighter_Stick,0,1,"button_0")

-- EXIT STRATEGY
 function exit_strategy ( )
        ipc.display("Exiting... ",2)        
        ipc.exit()        
end
-- Exit mode
--event.terminate("exit_strategy")

 


I have installed Version 4958g and tested as follows.  In each case, I run FSX, load the above lua file via key press combination, check that Button 0 is programmed correctly and then exit the sim via Ctrl+C.

The FSUIPC log files for the following three cases are given below

(1) with event.terminate enabled
(2) with event.terminate disabled and I invoke LuaKillAll via a key press combination
(3) with event.terminate disabled and I exit directly without invoking LuaKillAll

(1) with event.terminate enabled

********* FSUIPC4, Version 4.958g (29th November 2016) by Pete Dowson *********
Windows version reported as 6.2.?.9200
fsx.exe version = 10.0.61637.0
Reading options from "F:\FSX\Modules\FSUIPC4.ini"
Running inside FSX on Windows 8.0 or later
Module base=779A0000

    23375 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    25375 LUA.0: Button event: calling "button_0" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    25375 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:16
    25437 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:17
    25593 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:18
    25609 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:19
    25609 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    29781 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
    34328 === DLLStop called ...
    34328 === Getting Lua plug-ins to close ...
    34328 LUA.0: Terminate event: calling "exit_strategy" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    34328 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:26
    34328 List of Lua threads to be terminated:
    34328       0 = "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    34797 === Closing external processes we started ...
    34797 === About to kill my timers ...
    35000 === Restoring window procs ...
    35000 === Unloading libraries ...
    35015 === stopping other threads ...
    35218 === NOTE: not calling SimConnect_Close ...
    35218 === AI slots deleted!
    35218 === Freeing button memory ...
    35218 === Closing my Windows ...
    35218 === Freeing FS libraries ...
    36218 === Closing devices ...
    36218 === Closing the Log ... Bye Bye! ...
    36234 System time = 29/11/2016 20:11:32, Simulator time = 11:43:11 (19:43Z)
    36234 *** FSUIPC log file being closed
Minimum frame rate was 28.4 fps, Maximum was 30.0 fps
Minimum available memory recorded was 3091Mb
Average frame rate for running time of 11 secs = 29.2 fps
G3D fix: Passes 10509, Null pointers 0, Bad pointers 0, Separate instances 0
Maximum AI traffic for session was 19 aircraft
Memory managed: 13 Allocs, 13 Freed
********* FSUIPC Log file closed ***********

 

(2) With event.terminate disabled and I invoke LuaKillAll via a key press combination before FSX exit

********* FSUIPC4, Version 4.958g (29th November 2016) by Pete Dowson *********
Windows version reported as 6.2.?.9200
fsx.exe version = 10.0.61637.0
Reading options from "F:\FSX\Modules\FSUIPC4.ini"
Running inside FSX on Windows 8.0 or later
Module base=779A0000

    29859 LUA.0: Button event: calling "button_0" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    29859 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:16
    29922 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:17
    30078 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:18
    30094 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:19
    30094 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    33359 LUA.0: ended "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    38813 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
    42984 === DLLStop called ...
    42984 === Getting Lua plug-ins to close ...
    42984 List of Lua threads to be terminated:
    42984 === Closing external processes we started ...
    42984 === About to kill my timers ...
    43188 === Restoring window procs ...
    43188 === Unloading libraries ...
    43188 === stopping other threads ...
    43391 === NOTE: not calling SimConnect_Close ...
    43391 === AI slots deleted!
    43406 === Freeing button memory ...
    43406 === Closing my Windows ...
    43406 === Freeing FS libraries ...
    44406 === Closing devices ...
    44406 === Closing the Log ... Bye Bye! ...
    44422 System time = 29/11/2016 20:29:36, Simulator time = 11:43:15 (19:43Z)
    44422 *** FSUIPC log file being closed
Minimum frame rate was 28.2 fps, Maximum was 30.0 fps
Minimum available memory recorded was 3092Mb
Average frame rate for running time of 15 secs = 29.4 fps
G3D fix: Passes 10426, Null pointers 0, Bad pointers 0, Separate instances 0
Maximum AI traffic for session was 19 aircraft
Memory managed: 14 Allocs, 14 Freed
********* FSUIPC Log file closed ***********

 


(3) with event.terminate disabled and I exit directly without invoking LuaKillAll

********* FSUIPC4, Version 4.958g (29th November 2016) by Pete Dowson *********
Windows version reported as 6.2.?.9200
fsx.exe version = 10.0.61637.0
Reading options from "F:\FSX\Modules\FSUIPC4.ini"
Running inside FSX on Windows 8.0 or later
Module base=779A0000

    33079 LUA.0: Button event: calling "button_0" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    33079 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:16
    33141 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:17
    33297 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:18
    33313 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:19
    33329 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    37204 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
    41516 === DLLStop called ...
    41516 === Getting Lua plug-ins to close ...
    41516 List of Lua threads to be terminated:
    41516       0 = "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    41797 ***ERROR C0000005 at 771D6B89 StopAllLuaThreads(0)
    41797 ***      Access violation trying to read address 3ACFF998
    41797 ***      EAX 3ACFF988  EBX 3ACFF988  ECX 3ACFF98A  EDX 3ACFF988  EDI 3ACFF988  ESI 3ACFF98A
    41797 ***      EIP 771D6B89  EBP 000DF9CC  ESP 000DF9A0
    41813 ********** Modules List ***********
    41813 00D90000-00E39000 xuipc.dll
    41813 01000000-0129E000 fsx.exe
    41813 04BB0000-04BEF000 object_placement.dll
    41813 04BF0000-04C21000 simpropext.dll
    41813 04DE0000-04E08000 traffictoolbox.dll
    41813 04F70000-04F87000 visualfxtool.dll
    41829 0B640000-0B64E000 SimConnect.dll
    41829 0F770000-10545000 nvd3dum.dll
    41829 11870000-12416000 ieframe.dll
    41829 125C0000-13956000 mshtml.dll
    41829 20000000-20054000 ablscpt.dll
    41829 20060000-2008F000 acontain.dll
    41829 20090000-200D1000 ai_player.dll
    41844 200E0000-2021B000 API.DLL
    41844 20220000-20285000 atc.dll
    41844 20290000-202CD000 controls.dll
    41844 202D0000-202E4000 demo.dll
    41844 202F0000-20334000 facilities.dll
    41844 20340000-20456000 fe.dll
    41844 20460000-204DE000 flight.dll
    41844 204E0000-2065A000 fsui.dll
    41844 20660000-20715000 g2d.dll
    41844 20720000-20849000 g3d.dll
    41844 20850000-20873000 gps.dll
    41860 20880000-208F4000 language.dll
    41860 20900000-20921000 livingwater.dll
    41860 20930000-20A25000 main.dll
    41860 20A30000-20B26000 multiplayer.dll
    41860 20B30000-20BAE000 panels.dll
    41860 20BB0000-20C8A000 sim1.dll
    41860 20C90000-20CBC000 simprop.dll
    41860 20CC0000-20CCB000 simscheduler.dll
    41860 20CD0000-20D01000 sound.dll
    41860 20D10000-20D40000 symmap.dll
    41860 20D40000-20E21000 terrain.dll
    41860 20E30000-20E47000 fs-traffic.dll
    41875 20E50000-20F33000 ui.dll
    41875 20F40000-20F7D000 util.dll
    41875 20F80000-20FB2000 visualfx.dll
    41875 20FC0000-21013000 weather.dll
    41875 21020000-2104D000 window.dll
    41875 50010000-5001E000 msimtf.dll
    41875 50020000-50041000 srpapi.dll
    41875 50050000-50059000 msadp32.acm
    41875 50060000-5006B000 XInput1_4.dll
    41875 50070000-50095000 dinput.DLL
    41875 500A0000-500A8000 midimap.dll
    41875 500B0000-500E9000 wdmaud.drv
    41875 500F0000-50171000 RICHED20.DLL
    41875 50180000-503E3000 gameux.dll
    41891 503F0000-50457000 msvcp110_win.dll
    41891 50460000-50530000 d3d12.dll
    41891 50530000-5058C000 d3d10_1core.dll
    41891 50590000-506A5000 D3DCompiler_34.dll
    41891 506B0000-506E1000 msls31.dll
    41891 506F0000-507B7000 nvSCPAPI.dll
    41891 507C0000-5091F000 d3d9.dll
    41891 50920000-5098D000 d3dx10_34.dll
    41891 50990000-50CFF000 d3dx9_34.dll
    41891 50D00000-50D87000 MSVCP80.dll
    41891 50D90000-50E9F000 MFC80.DLL
    41891 50EA0000-50F8D000 DDRAW.dll
    41891 50F90000-51207000 AcLayers.DLL
    41891 55100000-5510A000 msacm32.drv
    41891 55110000-55138000 uiautomationcore.dll
    41891 55140000-55151000 winbrand.dll
    41891 55480000-554C7000 dxdiagn.dll
    41891 55540000-555D2000 apphelp.dll
    41907 55F90000-55F99000 AVRT.dll
    41907 55FA0000-55FD6000 DINPUT8.dll
    41907 57370000-5738F000 gpapi.dll
    41907 63A00000-63A16000 MPR.dll
    41907 64140000-64174000 MLANG.dll
    41907 65590000-6559A000 HID.DLL
    41907 65970000-65B04000 urlmon.dll
    41907 65B60000-65B67000 XInput9_1_0.dll
    41907 65B70000-65C0B000 MSVCR80.dll
    41907 65D50000-65D57000 ksuser.dll
    41907 65D60000-65DF4000 COMCTL32.dll
    41907 65E10000-65E1F000 sfc_os.DLL
    41907 66430000-6645C000 d3d10_1.dll
    41907 66460000-66466000 SHFOLDER.dll
    41907 66680000-66683000 sfc.dll
    41907 67FA0000-67FB8000 MSACM32.dll
    41907 68230000-6823E000 MFC80ENU.DLL
    41907 68290000-68297000 DCIMAN32.dll
    41907 682A0000-6831A000 AcSpecfc.DLL
    41907 68B30000-68EBB000 msi.dll
    41907 69350000-69579000 iertutil.dll
    41907 69580000-697AF000 WININET.dll
    41907 69B10000-69C3F000 MSXML4.DLL
    41907 69F20000-69FEF000 wintypes.dll
    41907 69FF0000-6A06B000 AUDIOSES.DLL
    41922 6A070000-6A0C8000 MMDevApi.dll
    41922 6A0D0000-6A1C1000 twinapi.appcore.dll
    41922 6A1D0000-6A2E3000 dcomp.dll
    41922 6A2F0000-6A334000 dataexchange.dll
    41922 6A340000-6A3C5000 mscms.dll
    41922 6A3D0000-6A8A8000 d2d1.dll
    41922 6BC70000-6BE9F000 d3d11.dll
    41922 6C0F0000-6C23F000 PROPSYS.dll
    41922 6C3C0000-6C5B5000 DWrite.dll
    41922 6C610000-6C627000 USP10.dll
    41922 6FCD0000-6FD92000 fastprox.dll
    41922 6FDA0000-6FE07000 wbemcomn.dll
    41922 702B0000-7041E000 WindowsCodecs.dll
    41922 70420000-70589000 gdiplus.dll
    41922 70690000-706B2000 DEVOBJ.dll
    41922 70750000-7079E000 MSWSOCK.dll
    41922 70980000-70990000 wbemsvc.dll
    41922 70990000-7099D000 wbemprox.dll
    41922 709A0000-709BF000 dwmapi.dll
    41922 709C0000-70A44000 dxgi.dll
    41922 714A0000-714CF000 rsaenh.dll
    41922 714D0000-714E3000 CRYPTSP.dll
    41922 714F0000-71533000 WINSTA.dll
    41922 71540000-715B5000 uxtheme.dll
    41922 72A50000-72A60000 WKSCLI.DLL
    41922 72B50000-72B5A000 Secur32.dll
    41922 734A0000-734AB000 NETUTILS.DLL
    41922 73680000-7388A000 COMCTL32.dll
    41922 73890000-73896000 MSIMG32.dll
    41922 738A0000-738CF000 IPHLPAPI.DLL
    41922 738D0000-738D8000 VERSION.dll
    41922 738E0000-738F3000 NETAPI32.dll
    41922 73960000-7397A000 USERENV.dll
    41922 73980000-7398F000 WTSAPI32.DLL
    41922 73990000-739B3000 WINMMBASE.dll
    41922 739C0000-73A14000 OLEACC.dll
    41922 73A20000-73A44000 WINMM.dll
    41922 73A50000-73AD9000 DSOUND.dll
    41922 73AE0000-73AFB000 bcrypt.dll
    41922 73B00000-73B6A000 WINSPOOL.DRV
    41922 73B70000-73B7A000 CRYPTBASE.dll
    41922 73B80000-73B9E000 SspiCli.dll
    41938 73BA0000-73D41000 KERNELBASE.dll
    41938 73D50000-73E11000 RPCRT4.dll
    41938 73EE0000-73F43000 WS2_32.dll
    41938 73F50000-73FAA000 bcryptPrimitives.dll
    41938 73FB0000-74090000 ucrtbase.dll
    41938 74090000-7449B000 SETUPAPI.dll
    41938 744A0000-74517000 advapi32.dll
    41938 74520000-7467B000 gdi32full.dll
    41938 74680000-7476A000 ole32.dll
    41938 74770000-74785000 win32u.dll
    41938 74790000-7480B000 msvcp_win.dll
    41938 748B0000-74A0F000 USER32.dll
    41938 74A10000-74A51000 sechost.dll
    41938 74A60000-74B1E000 msvcrt.dll
    41938 74C90000-74CD5000 powrprof.dll
    41938 74CE0000-760B9000 SHELL32.dll
    41938 760C0000-76144000 clbcatq.dll
    41938 76150000-76285000 MSCTF.dll
    41938 76390000-763A9000 imagehlp.dll
    41938 763B0000-76438000 shcore.dll
    41938 76440000-76446000 PSAPI.DLL
    41938 76450000-76496000 shlwapi.dll
    41938 764A0000-764CB000 GDI32.dll
    41938 764D0000-76A3E000 windows.storage.dll
    41938 76A40000-76B25000 COMDLG32.dll
    41938 76B30000-76B74000 WINTRUST.dll
    41938 76BE0000-76CC0000 KERNEL32.DLL
    41938 76CC0000-76CF6000 cfgmgr32.dll
    41938 76D10000-76F21000 combase.dll
    41938 76F30000-76F55000 IMM32.dll
    41938 76F60000-76FF4000 OLEAUT32.dll
    41938 77000000-7717D000 CRYPT32.dll
    41938 77180000-7718F000 profapi.dll
    41938 77190000-7719D000 kernel.appcore.dll
    41938 771A0000-771AE000 MSASN1.dll
    41954 771B0000-77332000 ntdll.dll
    41954 77600000-77752000 uiautomationcore.dll
    41954 779A0000-77FF5000 FSUIPC4.dll
    41954 ***********************************
    41954 EIP 771D6B89 is in ntdll.dll, Base=771B0000
    41954 Stack EBP 000DF9CC->771D6AED, which is ntdll.dll (Base=771B0000)
    41954 Stack EBP 000DF9E0->771EF881, which is ntdll.dll (Base=771B0000)
    41954 Stack EBP 000DF9F8->000DFDE4, which is  (Base=00000000)
    41954 Stack EBP 77A0818F->E8FFFC4D, which is  (BAD) (Base=00000000)
    41954 === Closing external processes we started ...
    41954 === About to kill my timers ...
    42157 === Restoring window procs ...
    42157 === Unloading libraries ...
    42157 === stopping other threads ...
    42360 === NOTE: not calling SimConnect_Close ...
    42360 === AI slots deleted!
    42360 === Freeing button memory ...
    42360 === Closing my Windows ...
    42375 === Freeing FS libraries ...
    43375 === Closing devices ...
    43375 === Closing the Log ... Bye Bye! ...
    43391 System time = 29/11/2016 20:31:06, Simulator time = 11:43:12 (19:43Z)
    43391 *** FSUIPC log file being closed
Minimum frame rate was 29.4 fps, Maximum was 30.0 fps
Minimum available memory recorded was 3082Mb
Average frame rate for running time of 12 secs = 29.4 fps
G3D fix: Passes 10416, Null pointers 0, Bad pointers 0, Separate instances 0
Maximum AI traffic for session was 19 aircraft
Memory managed: 12 Allocs, 12 Freed
********* FSUIPC Log file closed ***********


In all cases, FSX exits without the "Fatal Error" message I was getting before. 

I'm not sure if this is what you wanted but just let me know if you need any further testing,

Many thanks again for you support.

Best regards,

Mike.

Link to comment
Share on other sites

I also set TimeForLuaClosing=0 in the ini file and, on direct exit, the log file is as follows with a clean exit from FSX.

 

********* FSUIPC4, Version 4.958g (29th November 2016) by Pete Dowson *********
Windows version reported as 6.2.?.9200
fsx.exe version = 10.0.61637.0
Reading options from "F:\FSX\Modules\FSUIPC4.ini"
Running inside FSX on Windows 8.0 or later
Module base=779A0000

    46735 LUA.0: Button event: calling "button_0" in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    46735 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:16
    46813 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:17
    46985 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:18
    47016 LUA.0: F:\FSX\Modules\MGE_Cessna_Ctrl.lua:19
    47016 LUA.0: Waiting for an event in "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    51219 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
    51219 Sim stopped: average frame rate for last 26 secs = 29.6 fps
    51219              Max AI traffic was 19 aircraft
    55469 Deactivated for PID=5636, "notepad++.exe"
    55469 Lost focus to PID=5636, "notepad++.exe"
    55485 === DLLStop called ...
    55485 === About to kill and Lua plug-ins still running ...
    55500 LUA.0: ended "F:\FSX\Modules\MGE_Cessna_Ctrl.lua"
    55516 === Closing external processes we started ...
    55516 === About to kill my timers ...
    55719 === Restoring window procs ...
    55719 === Unloading libraries ...
    55719 === stopping other threads ...
    55938 === NOTE: not calling SimConnect_Close ...
    55938 === AI slots deleted!
    55938 === Freeing button memory ...
    55938 === Closing my Windows ...
    55938 === Freeing FS libraries ...
    56953 === Closing devices ...
    56953 === Closing the Log ... Bye Bye! ...
    56953 System time = 29/11/2016 21:07:09, Simulator time = 11:43:15 (19:43Z)
    56953 *** FSUIPC log file being closed
Minimum frame rate was 26.9 fps, Maximum was 30.0 fps
Minimum available memory recorded was 3074Mb
Average frame rate for running time of 26 secs = 29.6 fps
G3D fix: Passes 10399, Null pointers 0, Bad pointers 0, Separate instances 0
Maximum AI traffic for session was 19 aircraft
Memory managed: 19 Allocs, 19 Freed
********* FSUIPC Log file closed ***********

Link to comment
Share on other sites

2 hours ago, SeanMick said:

In all cases, FSX exits without the "Fatal Error" message I was getting before.

The only reason it didn't happen in the third case was because in this version of FSUIPC crashes during Lua closing are tapped. The log shows the details of the crash and it is in ntdll as before:

41954 EIP 771D6B89 is in ntdll.dll, Base=771B0000

Your original crash report showed the crash at "Fault offset: 0x00026b89 ". Well 771B0000 + 26B89 = 771D6B89, so the crash is identical to the one you were getting. Only the trap in FSUIPC saved the process from crashing. It still doesn't explain why, unfortunately. I am strongly suspecting some differences in the was the TerminateThread function works in Win10, because, as you found, Win7 doesn't do this, and i hve about 20 threads running using Events of all types and don't get a crash either in Win7.

As I said originally, I found several of my programs, working without problems for years, crash in Win10, some consistently some occasionally. Interestingly all the crashes appear to be in NTDLL.

So I'm putting this down to a Win10 incompatibility. At my age I've not got quite enough grey matter left to be able to, or be bothered to, investigate more deeply I'm afraid. I'd need better tools as well as a better (younger) brain.

Your subsequent test, testing the main change I made in FSUIPC 4.985h, shows the change worked fine: This is it in operation:

    55485 === DLLStop called ...
    55485 === About to kill and Lua plug-ins still running ...

Basically it is doing the same as you doing a LuaKillAll, so I expected it to work. The test was really to ensure I implemented it correctly. so thank you for that.

Pete

 

 

Link to comment
Share on other sites

Hi Pete,

Many thanks for that.  Since I posted, I've added the event.terminate code to a full version of one of my interface modules and, as I expected, it works fine so I'll move on now to the next install in the re-building process!!!  I'll certainly keep your cautions regarding Win10 in mind.

Best regards,

Mike.

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.