Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash during flight planning on Linux #2722

Closed
rkunze opened this issue Sep 18, 2020 · 4 comments
Closed

Crash during flight planning on Linux #2722

rkunze opened this issue Sep 18, 2020 · 4 comments

Comments

@rkunze
Copy link
Contributor

rkunze commented Sep 18, 2020

Setup: KSP 1.10.1 with Breaking Grounds and Making History, Principia Gateaux (no other mods beside Principia) on 64bit Arch Linux.

I can reproducibly crash KSP by starting a new sandbox game, F12-cheating a stock craft into LKO (100km orbit), and trying to set up a free return trajectory around the Mun using the Principia flight planner.

Flight planning goes smoothly for a couple of minutes, but after about 5 minutes (usually when I get to fine-tuning the trajectory) KSP gets a sigabrt and crashes.

Logs are at https://gist.github.com/rkunze/ae6eb6c0f187f917aa031161986ad417, but (at least for me) don't provide any insight into what went wrong.

Post mortem analysis of the dumped core with gdb gives this stack trace for the thread that caused the sigabrt:

coredumpctl gdb 2624
           PID: 2624 (KSP.x86_64)
           UID: 1000 (richard)
           GID: 985 (users)
        Signal: 6 (ABRT)
     Timestamp: Fri 2020-09-18 23:18:27 CEST (38min ago)
  Command Line: ./KSP.x86_64
    Executable: /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP.x86_64
 Control Group: /user.slice/user-1000.slice/user@1000.service/apps.slice/apps-org.gnome.Terminal.slice/vte-spawn-bd353af8-14a7-4c0d-a89a-babee474f9d1.scope
          Unit: user@1000.service
     User Unit: vte-spawn-bd353af8-14a7-4c0d-a89a-babee474f9d1.scope
         Slice: user-1000.slice
     Owner UID: 1000 (richard)
       Boot ID: b481d7f983ef49d39ef08dc6abedfb58
    Machine ID: 76fdbfd4305a44a59832e70ad949838c
      Hostname: doyle
       Storage: /var/lib/systemd/coredump/core.KSP\x2ex86_64.1000.b481d7f983ef49d39ef08dc6abedfb58.2624.1600463907000000.zst
       Message: Process 2624 (KSP.x86_64) of user 1000 dumped core.

GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP.x86_64...
(No debugging symbols found in /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP.x86_64)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `./KSP.x86_64'.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007ffa432ba615 in raise () from /usr/lib/libc.so.6
[Current thread is 1 (Thread 0x7ffa43278740 (LWP 2624))]
(gdb) backtrace
#0  0x00007ffa432ba615 in raise () at /usr/lib/libc.so.6
#1  0x00007ffa432a3862 in abort () at /usr/lib/libc.so.6
#2  0x0000000000d44094 in  ()
#3  0x00007ffa3482159e in  () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#4  0x00007ffa348215d7 in  () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#5  0x00007ffa4345a0f0 in <signal handler called> () at /usr/lib/libpthread.so.0
#6  0x00007ffa432ba615 in raise () at /usr/lib/libc.so.6
#7  0x00007ffa432a3862 in abort () at /usr/lib/libc.so.6
#8  0x00007ffa3490b36e in GC_unmap () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#9  0x00007ffa3490b3db in GC_unmap_old () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#10 0x00007ffa3490e2db in GC_finish_collection ()
    at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#11 0x00007ffa3490e544 in GC_collect_a_little_inner ()
    at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#12 0x00007ffa3490e9b2 in GC_allocobj () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#13 0x00007ffa3490f7e4 in GC_generic_malloc_inner ()
    at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#14 0x00007ffa3491265c in GC_generic_malloc () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#15 0x00007ffa349128c4 in GC_malloc_kind_global ()
    at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#16 0x00007ffa348e5a13 in  () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#17 0x00007ffa3489bb69 in  () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#18 0x00007ffa3489bbd0 in  () at /home/richard/Spiele/KSP/1.10.1/Principia+OPM+Grannus/KSP_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
#19 0x0000000040c9246f in  ()
#20 0x0000000000000002 in  ()
#21 0x0000000000000019 in  ()
#22 0x0000000000000019 in  ()
#23 0x00007ff8d0b53960 in  ()
#24 0x0000000000000004 in  ()
#25 0x0000000004506cd0 in  ()
#26 0x00007ff8d0b53960 in  ()
#27 0x00007ffdc9f5ebe0 in  ()
#28 0x0000000000000019 in  ()
#29 0x0000000040caad7c in  ()
#30 0x00007ff8d0b53910 in  ()
#31 0x00007ff8ce1773c0 in  ()
#32 0x00007ff8d0b53960 in  ()
#33 0x00007ff8ce1773c0 in  ()
#34 0x00007ff8d0b53890 in  ()
#35 0x0000000040da3cb4 in  ()
#36 0x0000000000000019 in  ()
#37 0x0000000000000001 in  ()
#38 0x00007ff8cb41cdc0 in  ()
#39 0x00007ff8ce1773f0 in  ()
#40 0x00007ff8ce1773c0 in  ()
#41 0x0000000040d8b4e4 in  ()
#42 0x00007ff8cb41cdc0 in  ()
#43 0x00007ff8d0b53910 in  ()
#44 0x00007ff8cb41cdc0 in  ()
#45 0x0000000040d87374 in  ()
#46 0x00007ff96dc567e0 in  ()
#47 0x00007ffdc9f5eda0 in  ()
#48 0x00007ff8ce6ced90 in  ()
#49 0x00007ff8cb41cdc0 in  ()
#50 0x0000000000000000 in  ()
(gdb) 

Other threads state at the time of the crash:

(gdb) info threads
  Id   Target Id                        Frame 
* 1    Thread 0x7ffa43278740 (LWP 2624) 0x00007ffa432ba615 in raise () from /usr/lib/libc.so.6
  2    Thread 0x7ffa0bfff640 (LWP 2635) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  3    Thread 0x7ffa20d22640 (LWP 2634) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  4    Thread 0x7ffa356dc640 (LWP 2629) 0x00007ffa434556a2 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
  5    Thread 0x7ffa0b7fe640 (LWP 2636) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  6    Thread 0x7ffa21523640 (LWP 2633) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  7    Thread 0x7ffa40e6a640 (LWP 2625) 0x00007ffa43458014 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
  8    Thread 0x7ff8456ff640 (LWP 3528) 0x00007ffdc9f90678 in ?? ()
  9    Thread 0x7ff9ea7fc640 (LWP 2645) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  10   Thread 0x7ffa0affd640 (LWP 2637) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  11   Thread 0x7ffa20157640 (LWP 2659) 0x00007ffa43344c51 in clock_nanosleep@GLIBC_2.2.5 () from /usr/lib/libc.so.6
  12   Thread 0x7ffa097fa640 (LWP 2640) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  13   Thread 0x7ffa35edd640 (LWP 2628) 0x00007ffa434556a2 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
  14   Thread 0x7ffa36edf640 (LWP 2626) 0x00007ffa434556a2 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
  15   Thread 0x7ff9eaffd640 (LWP 2644) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  16   Thread 0x7ffa0a7fc640 (LWP 2638) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  17   Thread 0x7ffa09ffb640 (LWP 2639) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  18   Thread 0x7ff9cbfff640 (LWP 2649) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  19   Thread 0x7ffa08ff9640 (LWP 2641) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  20   Thread 0x7ff9c97fa640 (LWP 2654) 0x00007ffa43458014 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
  21   Thread 0x7ffa366de640 (LWP 2627) 0x00007ffa434556a2 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
  22   Thread 0x7ffa21d24640 (LWP 2632) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  23   Thread 0x7ff9eb7fe640 (LWP 2643) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  24   Thread 0x7ff882b1c640 (LWP 3509) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  25   Thread 0x7ff9b2ffd640 (LWP 2657) 0x00007ffa4337246f in poll () from /usr/lib/libc.so.6
  26   Thread 0x7ff9ebfff640 (LWP 2642) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  27   Thread 0x7ff9e8ff9640 (LWP 2648) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  28   Thread 0x7ff88331d640 (LWP 3510) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  29   Thread 0x7ff9823ff640 (LWP 2664) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  30   Thread 0x7ff9e9ffb640 (LWP 2646) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  31   Thread 0x7ff88b9fe640 (LWP 3513) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  32   Thread 0x7ff9cb7fe640 (LWP 2650) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  33   Thread 0x7ff8899fa640 (LWP 3517) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  34   Thread 0x7ff88c1ff640 (LWP 3512) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  35   Thread 0x7ff9c9ffb640 (LWP 2653) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  36   Thread 0x7ff88a9fc640 (LWP 3515) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  37   Thread 0x7ff881b1a640 (LWP 3524) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  38   Thread 0x7ff9caffd640 (LWP 2651) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  39   Thread 0x7ff88a1fb640 (LWP 3516) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  40   Thread 0x7ff8889f8640 (LWP 3519) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  41   Thread 0x7ff9b01a7640 (LWP 3457) 0x00007ffa43344c51 in clock_nanosleep@GLIBC_2.2.5 () from /usr/lib/libc.so.6
  42   Thread 0x7ff885f1d640 (LWP 3520) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  43   Thread 0x7ff9ca7fc640 (LWP 2652) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  44   Thread 0x7ffa23fff640 (LWP 2630) 0x00007ffa43458014 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
  45   Thread 0x7ff8891f9640 (LWP 3518) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  46   Thread 0x7ff88571c640 (LWP 3521) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  47   Thread 0x7ff88491d640 (LWP 3511) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  48   Thread 0x7ff9b37fe640 (LWP 2655) 0x00007ffa43458014 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
  49   Thread 0x7ffa20164640 (LWP 2658) 0x00007ffa434556a2 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
  50   Thread 0x7ff9c8179640 (LWP 2660) 0x00007ffa43458014 in do_futex_wait.constprop () from /usr/lib/libpthread.so.0
  51   Thread 0x7ffa22626640 (LWP 2631) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  52   Thread 0x7ff88231b640 (LWP 3523) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  53   Thread 0x7ff88b1fd640 (LWP 3514) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  54   Thread 0x7ff9e97fa640 (LWP 2647) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
  55   Thread 0x7ff88411c640 (LWP 3522) 0x00007ffa43377d5d in syscall () from /usr/lib/libc.so.6
(gdb) 

Since the crash apparently occurred inside a GC thread, my first suspicion was a memory issue. But at the time of the crash, KSP had allocated only around 7.5 of the available 16 GB.

@pleroy
Copy link
Member

pleroy commented Sep 20, 2020

Thanks for reporting the problem, but I don't see that there is much that we can do about it. There is no Principia code on the failing stack, and no indication of any misbehaving caused by Principia in the logs. My guess is that this is a bug in Mono, based on the following message at the end of stderr.log:

mmap(PROT_NONE) failed

Googling that message leads to a Xamarin defect that was never fixed as far as I can tell. It doesn't help that Unity have their own fork of Mono, so it's impossible to tell which bugs have been fixed and which haven't.

I can completely believe that Principia triggers some Mono bugs that itself leads to an mmap failure, but I am not going down that rabbit hole. Also note that we build for Ubuntu, so by using Principia on a different distro you are in unexplored territory.

Sorry, something went wrong.

@pleroy pleroy closed this as completed Sep 20, 2020
@rkunze
Copy link
Contributor Author

rkunze commented Sep 20, 2020

Understandable. If I get any ideas where to look I'll see if I can fix it (or at least find a workaround).

Thanks for the pointer to the Mono bug - seems like this should be fixed (or at least worked around) by using something other than Boehm for the GC. Maybe I'll try to swap out the Unity version of Mono for something closer to what's provided on Arch (but this will probably open up a whole new can of worms - after all, Unity probably had a reason for providing their own fork).

One last comment though: If this is a bug in the forked Unity version of Mono, I'd expect it to happen on Ubuntu as well - after all, both systems are using the same code in this case. Did you have any reports of weird crashes in flight planning on Ubuntu?

Sorry, something went wrong.

@rkunze
Copy link
Contributor Author

rkunze commented Nov 7, 2020

Just in case anybody hits the same problem: Increasing vm.max_map_count as outlined here seems to help.

@xsrvmy
Copy link

xsrvmy commented Nov 29, 2020

@rkunze I'm getting it on Kubuntu as well so nothing to do with arch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants