Board index FlightGear Development Aircraft

777 freezes and FPS loss

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Re: 777 freezes and FPS loss

Postby Hyde » Sat Jan 23, 2016 10:24 pm

Gijs wrote in Mon Jan 18, 2016 9:06 pm:It may also be interesting to see if replacing those variables with fixed values has any effect.

@Gijs, When I change all the argument to fix value then issue does not occur.
What is the next step to investigate?

#Hooray, I still try to get abnormal value of argument. It's difficult since FG does not response when issue occurs only kill the process is the way to get out.
fgfs.log contains the output at that time? I'll try.
Hyde
 
Posts: 728
Joined: Fri Aug 12, 2011 1:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Re: 777 freezes and FPS loss

Postby Hyde » Sun Jan 24, 2016 1:27 pm

Now I might find a root cause.

At first see this image.
Image
As you can see the length of the trend vector is just 2mile length. You can see the gap.

Image
After passing the several legs and cruising, it extends to 3miles.
This requires larger radius to display low angle shape and cross over the 16 bit max value 65536.
Code: Select all
nasal:5:/home/hyde/work/FlightGear/flightgear/src/Scripting/NasalSys.cxx:425:#2 65834.28699873168
That causes memory usage explosion.

This vector length extension happens when you pass the many way point and might integrate the degree.
I position the ship directly to high altitude, the length is not changed as you can see.
Image

@Gijs,
Please fix this.
Thank you.
Last edited by Hyde on Sun Jan 24, 2016 5:05 pm, edited 1 time in total.
Hyde
 
Posts: 728
Joined: Fri Aug 12, 2011 1:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Re: 777 freezes and FPS loss

Postby Gijs » Sun Jan 24, 2016 1:46 pm

Hi,

Hm, small angles should be ignored (we check for abs(rollDeg) > 0.2), to prevent exactly this from happening. It'd be interesting to know what the values for groundspeed and roll were at the time of the crash.

As a quick hack, can you try limiting the radius and see if that indeed fixes it? E.g. something like (place it above the setData line):
Code: Select all
if (radius > 60000) radius = 60000;

The fact that positioning the aircraft at a certain altitude does not result in the correct vector length may be explained by the roll angle check. If you position it wings levelled, the vector isn't updated. This is simply an use-case that I did not design for.

Cheers,
Gijs

PS: The length is based on the ground speed (and range of the display), irrespective of altitude, waypoints or what else.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9380
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: 777 freezes and FPS loss

Postby biloute974 » Sun Jan 24, 2016 3:16 pm

This requires larger radius to display low angle shape and cross over the 16 bit max value 65536.

Hi,
It's not possible to use 32 bit max value ?
Intel I7 7700 - 16Gb DDR4 - Nvidia GTX970 - FG 2017.4.0 from D&C
biloute974
 
Posts: 191
Joined: Mon Feb 23, 2015 8:49 am
Callsign: U974
Version: 2016.1.0
OS: Mint 17.2

Re: 777 freezes and FPS loss

Postby Hyde » Sun Jan 24, 2016 4:17 pm

I've already started to test bracing rest of code after radius calculation with
if(radius < 65535)
and it works. No issue happens consecutive 4 flights. :D
Hyde
 
Posts: 728
Joined: Fri Aug 12, 2011 1:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Re: 777 freezes and FPS loss

Postby Gijs » Sun Jan 24, 2016 4:37 pm

Ah, I just read through the computations again and I can see where this is happening. It's because I didn't take the scaling factor to project the distance on the display into account (which adds a factor 100) :-) We most likely need to improve these calculations one day, but for now I've committed the simple check.

Thanks for the bug hunting!
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9380
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: 777 freezes and FPS loss

Postby biloute974 » Sun Jan 24, 2016 6:57 pm

Hi,

thanks for the fix.
Intel I7 7700 - 16Gb DDR4 - Nvidia GTX970 - FG 2017.4.0 from D&C
biloute974
 
Posts: 191
Joined: Mon Feb 23, 2015 8:49 am
Callsign: U974
Version: 2016.1.0
OS: Mint 17.2

Re: 777 freezes and FPS loss

Postby Hyde » Sun Jan 31, 2016 4:11 pm

O.K. Now freeze is fixed. Then FPS loss issue.
I've just implemented the elapsed time indication as CaptainTech requested.
I flew from RJTT to KATL for testing the indication.
It took 12h41m to complete.

I usually use the rembrandt whenever the machine is capable and the frame rate is around 20 at start. It's enough to operate.
But when I arrived at KATL, it drops to 5. :cry:
Image
I saw the flight, instrumentation, xml-autopilot and systems submodule iteration rate has been increased from 127 to 141 and others from decreased from 16 to 6.
Is there any way to control these rate on ship side? I think that iteration rate increase causes frame rate drop.
Please help.

Thanks,
Hyde
Hyde
 
Posts: 728
Joined: Fri Aug 12, 2011 1:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Re: 777 freezes and FPS loss

Postby Thorsten » Sun Jan 31, 2016 4:57 pm

How'd a iteration rate increase by 11% cause a framerate drop by 75%? I haven't done the exact numbers but it doesn't really sound like a fit.
Thorsten
 
Posts: 11090
Joined: Mon Nov 02, 2009 8:33 am

Re: 777 freezes and FPS loss

Postby Hyde » Sun Jan 31, 2016 5:05 pm

I just thought. If I was wrong correct me.
I just want to know why frame rate down after long flight and fix.
Hyde
 
Posts: 728
Joined: Fri Aug 12, 2011 1:09 pm
Location: Peachtree city, GA
Callsign: N407DS
Version: GIT
OS: Fedora 25

Re: 777 freezes and FPS loss

Postby Thorsten » Sun Jan 31, 2016 6:04 pm

It seems to be events aka Nasal - at least that's much heavier than anything else.
Thorsten
 
Posts: 11090
Joined: Mon Nov 02, 2009 8:33 am

Re: 777 freezes and FPS loss

Postby Hooray » Sun Jan 31, 2016 7:00 pm

Note that it would be better to look at the performance monitor stats without using the PUI dialog, e.g. by using the httpd-based property browser or the telnet daemon (--props).

You will have to manually activate the property browser (if in doubt, refer to menubar.xml for details)

Alternatively, use the property browser, which is more lightweight than the performance monitor dialog.

Like Thorsten said, usually, "events" means Nasal callbacks (timers) - however, it's also often not just Nasal per se, but misuse of timers - in general, settimer() is a API that is prone to being used improperly, because it needs to be consciously used, i.e. to enable/disable loops and to prevent them from being "registered" (invoked) too often - which is the most common pattern of misuse we've seen so far: Nasal based callbacks that end up being invoked dozens (or even hundreds) of times despite being only intended to be invoked once per interval.

However, to be fair, this is not specific to Nasal - A few months ago, Torsten fixed pretty much the exact same bug in the C++ effects code which was registering thousands of identical callbacks.

The underlying problem here is that the SGPropertyNode code does not currently support any form of troubleshooting, i.e. to do callback tracking - for details, refer to: http://wiki.flightgear.org/Towards_bett ... leshooting

The maketimer() API can be used to help prevent such issues when using timers, but listeners are a completely different matter (if in doubt, please file a feature request):

Subject: Listener objects
zakalawe wrote:Dumb question of the day. Someone recently pointed out that the setlistener() / removelistener() API makes it easy to leak resources. So I wondered about making an alternate API where the return value from setlistener must be kept, or the listener is removed. I can imagine this with a helper object

var myL = setlistener2("some/prop", func { ... }} )
myL.addprop("some/other/prop");
myL.addprop("yet/another/prop");

Now you need to retain a ref to myL or the listeners on all the props are removed. I don't think we can retro-fit this to the existing API, because I suspect many places just ignore the return value and would break with this change.

(Or even pass a vec of property names to setlistener2, to avoid all the discrete calls to 'addprop', that's a seperate detail really)

It seems like this would work, and be easy enough to implement - question is if it gives enough benefit to be worth the confusion.
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: 11349
Joined: Tue Mar 25, 2008 8:40 am

Re: 777 freezes and FPS loss

Postby biloute974 » Sun Jan 31, 2016 7:21 pm

Hi,

i can confirm that freeze is fixed ;)
But FPS loss... not. For example, T/O at LFLL with 80 FPS and landing at LFPG with 35 FPS after 45 minutes of flight.
Intel I7 7700 - 16Gb DDR4 - Nvidia GTX970 - FG 2017.4.0 from D&C
biloute974
 
Posts: 191
Joined: Mon Feb 23, 2015 8:49 am
Callsign: U974
Version: 2016.1.0
OS: Mint 17.2

Re: 777 freezes and FPS loss

Postby legoboyvdlp » Sun Jan 31, 2016 7:30 pm

Hint, hint, most users with ordinary computers can't run Paris.
Not with the entire city modelled, a large amount of roads,and all that.
User avatar
legoboyvdlp
 
Posts: 7096
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: 777 freezes and FPS loss

Postby Hooray » Sun Jan 31, 2016 7:39 pm

biloute974 wrote in Sun Jan 31, 2016 7:21 pm:Hi,

i can confirm that freeze is fixed ;)
But FPS loss... not. For example, T/O at LFLL with 80 FPS and landing at LFPG with 35 FPS after 45 minutes of flight.


based on what we "know" so far, it's probably leaking Nasal callbacks that are re-registering themselves over time, so that they end up being called dozens of times per frame

To learn where your code is leaking Nasal callbacks, you would need to use the Nasal call()/caller() APIs

you can wrap settimer() and make it add each callback to a vector using the identify of the callback: id(callback) - once you do that, you can get the number of all registered timers and print/size() them to the console, this should also enable you to tell if there are identical callbacks registered that don't expire.

Otherwise, you would need to patch the C++ code to do just that in FGNasalSys
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: 11349
Joined: Tue Mar 25, 2008 8:40 am

PreviousNext

Return to Aircraft

Who is online

Users browsing this forum: AhrefsBot [Bot], Robertfm and 0 guests