Yesterday I hit an one-off crash related to MapStructure which I can't seem to reproduce again.
At the end of 2-ish hour flight from KBOS to CYYT I accidentally clicked "Map (Canvas)" instead of "Map", and FG exited with this error:
6103.32 [ALRT]:nasal Nasal runtime error: function/method call on uncallable object
6103.32 [ALRT]:nasal at /home/mike/src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas, line 310
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas, line 341
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas, line 377
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas, line 385
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/canvas/map/VOR.symbol, line 73
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas, line 731
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas, line 721
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas, line 416
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas, line 1099
6103.32 [ALRT]:nasal called from: /home/mike/src/git/flightgear/fgdata/Nasal/geo.nas, line 439
6103.33 [ALRT]:headless Fatal Error: "Fatal exception"
6103.33 [ALRT]:headless Error Message: "function/method call on uncallable object"
corrupted size vs. prev_size in fastbins
The aircraft does not use any Canvas; Route Manager is disabled as well. But it does use Nasal flightplan to visualize the route on the map, which was: TUSKY BITRA SP PERLU [sic, without the airports]. Nasal that plots the route:
https://gitlab.com/mdanil/Tu-144/-/blob/master/Nasal/Orbita-10.nas#L25
Version info:
flightgear 94ff2f8ee 2020-08-19 Load APT1000 comm frequencies correctly. (origin/next, origin/HEAD, next) [James Turner]
simgear e85a3207 2020-08-19 Add newer FindGDAL with imported target support (HEAD -> next, origin/next, origin/HEAD) [James Turner]
fgdata 0c521de80 2020-08-21 FG1000: Better handling of VFR transponder code (origin/next, origin/HEAD, next) [Stuart Buchanan]
Putting his thing to
ufo.nasdoes exactly what that Nasal I linked to did:But of course the problem is something other than Nasal flightplan, because the stack mentions VOR, which Nasal flightplan should have no idea of because I simply use coordinates.
Last edit: Anonymous 2020-08-23
When you use the Canvas map, it always tries all layers, that's why it mentions VORs.
The FG crash is bad though. If it's on next, did you remember to disable threaded GC?
No, I was using it. Could it cause the crash? Is flipping the
/sim/nasal-gc-threadedthe right way to disable it, and does it work runtime or only as--propstartup arg?Yep threaded GC could cause this easily. You can change it at runtime but I'm going to disable it by dsefault I think.
Just had the same crash again when hitting "Map (Canvas)" by accident, and nasal-gc-threaded was false this time. Route:
UUDD SF NRM MF UUDD.Version info:
Last edit: Anonymous 2020-12-15
Are the crashes always when using the visualization code in Orbita.nas ? What I'm wondering is if you are building some odd waypoints, which cause the Canvas-map code to break. Although, it would only produce errors, not crash, then.
So far yes. I am building only the waypoints, without departure and destination airports.
Ah wait, this is strange: 'Error Message: "function/method call on uncallable object"'
That's a nasal error become a fatal error, which should not normally happen. So there's two things:
The second one is surprising. If you make some trivially broken Nasal code (in a test file), I guess that does not crash your sim?
eg even:
var i = 42;
i.foo();
... which should give exactly the same error about 'function/method call on uncallable object'
Yes, this is strange. I insert this, and it does not crash.
About aircraft peculiarities: I also have
Trying to check the source from the trace, I see this:
fgdata/Nasal/canvas/MapStructure.nas:310isvar i = id(m);But it doesn't seem to call any member function of any object?
Also: could it be that it happens because Orbita-10.nas names waypoints simply as "PPM1", "PPM2" etc instead of their callsigns?
id(m) is the call maybe? The reason I guessed this was GC related, is that one of the symtoms of GC bugs, is that standard/built-in hashes lose their contents, which shows up as missing functions.
I don't think the name of the WPs should matter at all, though, it's just a string which is passed around.
I know what's going on!
src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas:320:can make FG exit because I tried inserting
die("asdf")after id(m), and FG exits. Maybe if it encoutners 2 exceptions at a time, then the new message does not get through, and we still see the previous one?Last edit: Anonymous 2020-12-15
Ah yes, a runtime error (which is also what die() does) during a runtime error might do something strange. Can you reduce this to a stand-alone .nas file I can run, which crashes FG? Then I could add this to the test-suite, and of course fix it properly.
I still found no way to reproduce it. I will try leaving UFO overnight to fly around the world and open/close the dialog, with the same points in route manager as I had.
Damn, we'll have to keep researching then :/
Didn't bother with the UFO... I changed that die() to a print(), will try to just open the Canvas map after each landing in the usual flights, maybe it will show something.
Today I had it again, and even though I swapped die() to print() it still crashed. Thank god I did it on purpose while having finished the flight. Will try adding more print()s there to see what's going on...
So far I can only confirm that
var i = id(m);is the last line that is run in MapStructure.nas before it exits.I noticed that it absolutely requires a full flight, and it evades any attempt to catch it with shorter flight or time speed-up . So maybe it's indeed a GC error, and something gets deleted that wasn't supposed to? But I have
nasal-gc-threadedfalse?One more thing is (and probably more important than MapStructure error itself) is, if you insert anything invalid into serialize(), say,
asdfgh();, then FG will exit on the error, instead of just reporting it.Maybe Canvas's Nasal errors are somehow counted as "more fatal" than other fatal Nasal errors, and make FG exit?
When inserting an invalid function name and trying to spawn Canvas map, in UFO:
Last edit: Anonymous 2020-12-19
Okay, let me have a play with that, and see if anything pops up.