Menu

#2356 MapStructure Map (Canvas) crash

2020.4
Fixed
nobody
Nasal (83)
Low
2024-07-02
2020-08-23
No

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]

Discussion

1 2 > >> (Page 1 of 2)
  • Anonymous

    Anonymous - 2020-08-23

    Putting his thing to ufo.nas does exactly what that Nasal I linked to did:

    settimer(func {
     var nfp = flightplan();
     nfp.cleanPlan();
     nfp.appendWP(createWP(43.565, -67, "PPM 1"));
     nfp.appendWP(createWP(45.106389, -61.878889, "PPM 2"));
     nfp.appendWP(createWP(46.7625, -56.169444, "PPM 3"));
     nfp.appendWP(createWP(47.290144, -54.046158, "PPM 4"));
    }, 3.0);
    

    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
  • James Turner

    James Turner - 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?

     
  • Anonymous

    Anonymous - 2020-08-23

    No, I was using it. Could it cause the crash? Is flipping the /sim/nasal-gc-threaded the right way to disable it, and does it work runtime or only as --prop startup arg?

     
  • James Turner

    James Turner - 2020-08-24

    Yep threaded GC could cause this easily. You can change it at runtime but I'm going to disable it by dsefault I think.

     
  • James Turner

    James Turner - 2020-08-24
    • labels: --> Nasal, GC, Threading
     
  • legoboyvdlp

    legoboyvdlp - 2020-08-28
    • Milestone: None --> 2020.2
     
  • Anonymous

    Anonymous - 2020-12-15

    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:

    flightgear 62cdd3081 2020-12-14 Fix a GPS bug identified by Jonathan Redpath (origin/next, origin/HEAD) [James Turner]
    simgear 39d616a0 2020-12-15 Support Boost v1.75 (HEAD -> next, origin/next, origin/HEAD) [Scott Giese]
    fgdata c1d1932e5 2020-12-12 Menubar auto-hide when leaving normal mouse mode. (origin/next, origin/HEAD) [James Turner]
    OpenSceneGraph a827840ba 2020-01-31 Updated ChangeLog (HEAD, tag: OpenSceneGraph-3.6.5, OpenSceneGraph-3.6) [Robert Osfield]
    
     

    Last edit: Anonymous 2020-12-15
  • Anonymous

    Anonymous - 2020-12-15
    • summary: MapStructure: one-off crash --> MapStructure Map (Canvas) crash
     
  • James Turner

    James Turner - 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.

     
    • Anonymous

      Anonymous - 2020-12-15

      So far yes. I am building only the waypoints, without departure and destination airports.

       
  • James Turner

    James Turner - 2020-12-15

    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:

    • Nasal MapStructure runtime error: these unfortunately happen a lot, until someone improves that code
    • somehow a Nasal runtime error became a simulator fatal error for you.

    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'

     
    • Anonymous

      Anonymous - 2020-12-15

      Yes, this is strange. I insert this, and it does not crash.

      About aircraft peculiarities: I also have

       <autopilot>
        <route-manager>
         <disable-fms type="bool">true</disable-fms>
        </route-manager>
       </autopilot>
      
       
  • Anonymous

    Anonymous - 2020-12-15

    Trying to check the source from the trace, I see this:

    fgdata/Nasal/canvas/MapStructure.nas:310 is var i = id(m);
    But it doesn't seem to call any member function of any object?

     
  • Anonymous

    Anonymous - 2020-12-15

    Also: could it be that it happens because Orbita-10.nas names waypoints simply as "PPM1", "PPM2" etc instead of their callsigns?

     
  • James Turner

    James Turner - 2020-12-15

    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.

     
  • Anonymous

    Anonymous - 2020-12-15

    I know what's going on!

    src/git/flightgear/fgdata/Nasal/canvas/MapStructure.nas:320:

            } else die("type not supported for style serialization: '"~t~"'");
    

    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
  • James Turner

    James Turner - 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.

     
  • Anonymous

    Anonymous - 2020-12-15

    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.

     
  • James Turner

    James Turner - 2020-12-16

    Damn, we'll have to keep researching then :/

     
  • Anonymous

    Anonymous - 2020-12-16

    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.

     
  • Anonymous

    Anonymous - 2020-12-17

    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...

     
  • Anonymous

    Anonymous - 2020-12-19

    So far I can only confirm that var i = id(m); is the last line that is run in MapStructure.nas before it exits.

     
  • Anonymous

    Anonymous - 2020-12-19

    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-threaded false?

     
  • Anonymous

    Anonymous - 2020-12-19

    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:

       16.93 [ALRT]:nasal     /home/mike/src/git/flightgear/flightgear/src/Scripting/NasalSys.cxx:1453: Nasal runtime error: undefined symbol: asdf
    ...
       16.93 [ALRT]:headless  /home/mike/src/git/flightgear/flightgear/src/GUI/MessageBox.cxx:181: Fatal Error: "Fatal exception"
       16.93 [ALRT]:headless  /home/mike/src/git/flightgear/flightgear/src/GUI/MessageBox.cxx:182: Error Message: "undefined symbol: asdf"
    
     

    Last edit: Anonymous 2020-12-19
  • James Turner

    James Turner - 2020-12-19

    Okay, let me have a play with that, and see if anything pops up.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

MongoDB Logo MongoDB