Board index FlightGear Support Flying

How to patch FG to disable terrasync

Controlling your aircraft, using the autopilot etc.

Re: How to patch FG to disable terrasync

Postby wkitty42 » Tue Sep 11, 2018 10:48 pm

actually, FG builds by default as RelWithDebInfo so there is some debug data available... as far as the source files, i simply point gdb to the FG sources as shown in my script above... plus, when you're in gdb and FG has frozen, CTRL-C will terminate it... just switch from the frozen FG screen to the console where gdb is running and CTRL-C there... of course this only helps when you run FG in gdb...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: How to patch FG to disable terrasync

Postby Thorsten » Wed Sep 12, 2018 7:23 am

Sorry, I need to clarify that FG does not crash - it simply freezes. (...) the strange thing is that the CPU fan is not making much noise as it does during the actual flight,


I have the phenomenon on one of my Linux boxes that when I plug in an external harddrive and remove it, a kworker thread is active at 33% CPU usage.

That causes only a modest amount of CPU fan, but when I start FG, it literally takes forever to load (5+ minutes for what usually starts up within 20 seconds and then basically freezes up at a frame ever few seconds) and never utilizes more CPU power.

It seems to be an OS bug (which is absent on my other Linux installations) not related to FG at all - could you see something similar?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: How to patch FG to disable terrasync

Postby AndersG » Wed Sep 12, 2018 8:04 am

I see above that you have 3GB of RAM in the machine? Are you sure you are not just running out of RAM and get stuck in paging/swapping?
With that little memory you'll need to be very careful about which aircraft you try to start and the complexity of the scenery where you are.
I'd imagine that any of the well developed airliners as well as the c172p and J3 Cub is out due to their size. Have you tried with the UFO?

If you use top or a similar tool you can easily see the amount of swap being used and the amount of IO waiting that happens.
Callsign: SE-AG
Aircraft (uhm...): Submarine Scout, Zeppelin NT, ZF Navy free balloon, Nordstern, Hindenburg, Short Empire flying-boat, ZNP-K, North Sea class, MTB T21 class, U.S.S. Monitor, MFI-9B, Type UB I submarine, Gokstad ship, Renault FT.
AndersG
 
Posts: 2524
Joined: Wed Nov 29, 2006 10:20 am
Location: Göteborg, Sweden
Callsign: SE-AG
OS: Debian GNU Linux

Re: How to patch FG to disable terrasync

Postby kwanza » Wed Sep 12, 2018 2:41 pm

I run FG today successfully both with the gdb script and directly through the launcher. On both occasions I used the 777 aircraft. The gdb output does not indicate any major problem except the following:

Nasal runtime error: No such member: set_radio_mode
at /sim/gui/dialogs/radios/dialog/group[2]/button[3]/binding[3], line 1

And on exit:
Thread 23 "fgfs" received signal SIG32, Real-time event 32.

My puzzlement is why I have such inconsistency with FG, one minute in heaven and the next in the deep freeze. To be clear, when a freeze happens it is practically total. Everything stops: the clock, the keyboard, the mouse, any background jobs. So I can never use tools like top, htop, etc to check on the system status. What I tend to do is:
- run FG with the command "cpulimit -k -z -l 195 -- /usr/bin/fgfs $options" so that it will automatically be killed if the CPU demand exceeds 195%
- set up a terminal with the pre-typed command "pkill fgfs" and put the focus on it in case I still have a chance of killing it before it enters into the deep freeze
If either to this precautions fail, then I have to do a kernel reboot of if I am lucky I can kill the whole desktop with Ctrl+Sight+Backspace.

Something that might be relevant is that the freeze happens just before the plane appears or (less frequently) just before landing (nearing touchdown). Some planes can trigger a freeze or crash on a sound event (e.g. Mil-Mi-24). The Mirage-2000 is impossible to use on my system since it requires too much computing power.

I suspect one of the following to be causing the problem:

1. Memory: I actually have 4x1G memory with 13G of swap space. Could it be that I have too much swap vis-a-vis physical memory? But why the inconsistent performance?

2. Graphics driver: My latest success came from running FG on a non-compositing desktop (WindowMaker). Yesterday's freezes were on KDE Plasma. So could FG be clashing with the desktop for the graphics accelerator?

3. Sound: I use pulseaudio, but I am not sure it FG cares about that. On some freezes, the sounds continues in the background (as a loop) whilst all else is frozen. However, mostly the sound is not available during the freeze.

4. osgPlugins: Only based on my suspicions from old logs years ago when it used to produce database errors.

This setup is the same for all other high-intensity applications. The difference is consistency. If I build Chromium for example, I know that the system is will freeze around the 2/3rd mark for ~4 hours, so I can plan for it. The symptoms are the same as with the FG freeze. Incidentally, I don't allow a 4 hour freeze with FG because a few years ago my old motherboard was literally melted by FG when I forgot to kill it and went out on an errand. :)
kwanza
 
Posts: 75
Joined: Tue Aug 12, 2008 8:07 am

Re: How to patch FG to disable terrasync

Postby Thorsten » Wed Sep 12, 2018 3:00 pm

But why the inconsistent performance?


Everything freezes once you start to dig into swap, because no process can't get fast memory access any more. So with the full description, I concur with Anders - you're running out of memory.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: How to patch FG to disable terrasync

Postby kwanza » Wed Sep 12, 2018 11:04 pm

Thanks a lot for the tips. I agree that the memory might be the main issue. Two things still puzzle me:

1. Does FG have different memory requirements for the same plane and airport on each invocation of the program? If not, why should it run out of memory on some launches and then work on the next?

2. Did the 2016 series of FG have lower memory requirements since it worked with my current setup?

I guess what I still don't understand is the inconsistency of the program.
kwanza
 
Posts: 75
Joined: Tue Aug 12, 2008 8:07 am

Re: How to patch FG to disable terrasync

Postby Thorsten » Thu Sep 13, 2018 5:45 am

1. Does FG have different memory requirements for the same plane and airport on each invocation of the program? If not, why should it run out of memory on some launches and then work on the next?


It might not be FG - there may be something else in the OS also using memory. if it's a marginal case, a few MB might make a difference (and FG, dependent on weather, will also have somewhat different requirements - in fine view it needs more terrain, in poor view less, clouds occupy dependent on how many there are,...)

2. Did the 2016 series of FG have lower memory requirements since it worked with my current setup?


At least the C-172p is always receiving upgrades which probably make it more costly. There may also be changes to scenery objects,...

Again, if you're seeing a marginal case, it really doesn't take much.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: How to patch FG to disable terrasync

Postby Hooray » Sun Sep 16, 2018 10:51 am

AndersG wrote in Wed Sep 12, 2018 8:04 am:If you use top or a similar tool you can easily see the amount of swap being used and the amount of IO waiting that happens.


FWIW, quite a while ago (actually, back in 2015), some of us came up with patches integrating the SIGAR (System Information Gatherer And Reporter) library into fgfs to track process/system related info and publish that in the global property tree in a cross platform fashion, at the time this was in response to Stuart's "random buildings" feature gobbling up memory like crazy, so that people would run into paging/swapping.

http://wiki.flightgear.org/FlightGear_N ... tilization
Image

IIRC, I believe it was Hamza who also added VRAM/GPU tracking support:

http://wiki.flightgear.org/Resource_Tra ... FlightGear
Image

Obviously, once such data is made available via the property tree, it would be trivial to also show it in the help/about dialog for troubleshooting purposes:
Image

Likewise, the same information could be used for feature scaling purposes:
http://wiki.flightgear.org/Feature_Scaling
http://wiki.flightgear.org/Graphics_card_profiles
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: How to patch FG to disable terrasync

Postby kwanza » Mon Sep 17, 2018 10:40 pm

Over the weekend, I was compiling a couple of other packages which use up a lot of memory during the compilation phase. One of them ran out of memory and the build failed with an "out of memory" error. Could FG be modified so that (like gcc) it dies with such an error when it is short of memory? At least that we we know precisely what the issue is and thus the possible fix is.
kwanza
 
Posts: 75
Joined: Tue Aug 12, 2008 8:07 am

Re: How to patch FG to disable terrasync

Postby kwanza » Mon Sep 24, 2018 1:44 pm

This is a just tip for anyone who might suffer the problems I reported at the beginning. My solution was to double my memory which significantly improved my experience (even to the point of being able to fly a Mirage finally). However, I am of course still constrained by my CPU. So, I would add the following recommendation to FG:

In order to fly a high fidelity aircraft, you will need at least 8GB of RAM. Anything less that 8GB will severely limit your options of usable planes and lead to frequent freezes during scenery loading.
kwanza
 
Posts: 75
Joined: Tue Aug 12, 2008 8:07 am

Previous

Return to Flying

Who is online

Users browsing this forum: No registered users and 5 guests