Generic "why are there CTD at all"

This is not a question specific to FS2020 - but why do we get CTD at all? I am a programmer (Delphi) and my software NEVER suffers from this. Obviously I get errors and bugs - but they are trapped and reported to the user.

For some reason flight simulators (FSX, XPlane and now FS2020) seem to suffer from this problem. Just for general interest, I would like to know why CTDs ever occur at all. Surely if the programmers see a problem (with a device, RAM, whatever), they should trap the error and report it? Tell the user or log the details to a file or something? Not simply crash with no warning to the desktop. I am also thinking it does the programmer no good either - they want as much information about the problem so that they can fix it.

Is it a limitation of the programming language used? Is it due to the generic nature of user plugins that the host cannot control or monitor?

If a programmer in this area knows the answer to this, I would like to know. Again, this is not a specific FS2020 issue at all.

1 Like

It’s a combination of the complexity of the simulator, the strain it puts on the hardware, and the infinite possibilities of different computer hardware configurations, driver versions and firmware versions.
Combined with hardware that buckles under the heavy loads (mostly cheaper Powersupplies) there is a lot that can go wrong.
Throw in player made mods, people messing with .cfg files etc, and it gets even worse :slight_smile:

I am not sure that you are correct. I agree that all those things can cause problems - the job of a programmer is to anticipate those problems and trap them. I do this sort of stuff all day long.

I am wondering why these problems are not trapped. Is it because the programmers can’t due to some limitation of the lanuage used? Is it because they are depending on outside hardware? ie you send a “draw this polygon” to the GPU and you have no control over it? If API calls are being made, surely the API is trapping errors?

2 Likes

with the amount of processes running in this sim (aero, data streaming, weather etc etc etc) I’m sure the logging required to pinpoint every unexpected event would add so much load that the Sim would be slowed down to single digit FPS.

That is not generally how it works. If there is no error, then nothing happens. What generally happens is that the OS returns an error code. You trap for that. For example - you might want to open a connection to the internet. You do the API call and you get a response code. The code tells you what happened. Either a success or not, and if not the return code should tell you why not. And you can log that or show a message to the user.

You don’t simply close the program and quit. Something is different with these sorts of programs. XPlane also does CTD, but it generally dumps a log file with hopefully some helpful information. I think FS2020 does something similar with the Windows exception log. Not very helpful, even if you can locate the error.

This is nothing against FS2020. I guess this is more of a technical question (being a programmer myself) and perhaps not a topic for this forum.

2 Likes

Most common thing IMO: People overclock their boxes and fill them with 10000 unknown pieces of software that interact the hog the machine when something really important wants resource -> BSOD.

1 Like

If a hardware issue (like unstable memory leading to memory corruption) that would corrupt the runtime & traceback stack, then I would assume no error can be produced or captured?

It is quite a common behavior when overclocking slightly above limit. You won’t have BSOD but random programs CTD without error message.

Surely it is a function of the OS to control and manage such things? Xplane works on the PC, Mac and Linux. I wonder if the CTD issue is the same on all of those OS’s? Is it an OS issue perhaps?

Disagree. Even if you are (to your mind) only running just the simulator (whatever one) - check out the running services and processes. You are actually running perhaps hundreds of programs already.

Even if you are running a few other visible programs - it is a core requirement of your OS to manage that. Just running another program should have no effect on the one you are currently focussed on. It should never increase your odds of getting a CTD in any way.

Points about overclocking miss the point when CTDs are reproducible by everyone by following very basic repro steps (e.g. turning the ALT dial in the Mooney).

(Yes, overclocking increases likelihood of CTDs in other scenarios.)

1 Like

Most software is compiled with libraries or an API that includes some error handling or a debug layer. The debug layer causes a big performance hit in Direct3D apps, however, so it’s turned off for production code. You usually check an “hresult” when making a call to the Direct3D API to see if a call succeeded or failed. If Flight Simulator is not producing error messages or a log file when it crashes, I’m assuming the devs simply haven’t implemented this kind of error handling in their software. They might just be relying on the debug layer and development environment when testing internally, and the user is left this “it works, or it doesn’t” version that doesn’t include robust error handling and reporting. Somebody else with more hands on experience with C++ and the native D3D API could hopefully chime in. I’m a scrub C# developer and have been working with managed code and Direct3D using SlimDX or XNA which gives you all kinds of conveniences.

Delphi is a strongly typed, high-level language compared to C++ which is weakly typed and low-level. For example, in C++ an integer can suddenly be interpreted as a pointer to a memory location, causing all sorts of errors.

The easy answer is that C++ is â– â– â– â– , Delphi is good.

1 Like

Ok - this makes real sense to me. I thought it must be something like that because as far as I know, a Delphi program never generates a CTD.

Sure. Same in Delphi - in development I run in Debug mode as well. It at least doubles the size of the EXE file. But there is still error trapping in the production code.

It seems to be an issue/feature of C++ code.

It’s more a Direct3D issue, which uses a COM API that doesn’t give you nice error handling with which you can cleanly and safely handle exceptions. It instead hands you back codes, which you have to check regardless of what language you’re using.

C++ provides built in error handling, and so does Delphi. Using Direct3D is more like programming in C, in which you have to manually implement the same kind of functionality. This can create a lot overhead and performance issues when it’s not needed or improperly implemented. If you’re using Direct3D with another language, they often create wrappers or interfaces that add this error handling for you.

Ok, that makes a lot of sense. That might explain why XPlane has the same sorts of problems.

Thanks, being a former sysadmin, developer in VB, Python, C++, Java and a long time user of Windows i wouldn’t know :stuck_out_tongue: Please don’t assume that people have no clue what they are doing.

I have 103 running services on this gaming box. and 153 processes. That is not hundreds and most of them are in idle until the are triggered by an event that they are supposed to deal with. I can tell you the exact size of each process module and the filehash if you want me to.

What i was trying to say is this: people install lots of â– â– â– â–  on their system and a few of them begin to hog system resources randomly. The base services do not do this.

That does not invalidate my point.

Low level does not mean that it is crap, it do mean that you have to be careful with your variables and use proper error trapping (which now C# have - which people should move to). VB.NET is like Delphi, very type safe, but i can generate a CTD with it, given a bit of time, i can probably trigger the same condition in Delphi.

Only reason to use Delphi in 2020 is to make it hard for malware researchers to decode your stuff :smiley: Even NSAs Ghidra (freeware decompiler) have problems with Delphi payloads.

I play games on my PC every single day, sometimes for 10~12 hours at a time and CTD’s is something that I VERY rarely ever encounter, in any game. It’s just not a thing for me, seriously. And I think I’ve had only one BSOD in the last 12 months, which was because I was trying to install an older video driver that probably wasn’t compatible with my 2080. (It was for experimental purposes.)

I don’t overclock anything, ever, and I don’t run any unnecessary programs in my tool tray for anything. No fps counters, no capture software, no temp monitors, no emulators, no fan controls, no LED controllers, etc. I have Windows Defender, my Logitech Gaming control panel, and a Soundblaster control panel, and that’s it. (Maybe Skype occasionally if I’m working from home.)

Is that why I don’t get CTD’s? I honestly don’t know, so I’m not going to make that claim. I’m just sayin’, that’s how I roll and CTD’s are a non-issue.

Maybe, it can also be hardware configuration choices, like having a GPU that ■■■■ the powersupply dry of watts, that can cause the system go to belly up. I don’t have CTDs or BSODs when i play either, i run standard vanilla stuff like you and I’m fine.

Never had a CTD on my recent games boxes, another factor could be that i stopped pirating games over 15 years ago (not saying that anyone here pirate MSFS, more of a statement about my choice than others). I remember that some warez were really ■■■■ and caused crashes and some had “features” like malware.

1 Like

As a Delphi programmer, I would be interested in how you generate a CTD. Just the general concept would do, not detailed code.