App crashing when forking child/clone process


#1

I’ve build godot from master on 16.04 and packaged it up as a snap. I’m just prototyping this with a view to pushing a future build to the store for ease of install. However at the moment the editor crashes out once I create a brand new project. It’s highly likely this is related to the application confinement. I can run the binary outside confinement and it works fine.

Here’s the output when I run godot from the snap.

WARNING: initialize: Error setting locale modifiers
   At: platform/x11/os_x11.cpp:149.
WARNING: initialize: XOpenIM failed
   At: platform/x11/os_x11.cpp:184.
WARNING: initialize: XCreateIC couldn't create xic
   At: platform/x11/os_x11.cpp:361.
OpenGL ES 3.0 Renderer: GeForce GTX 980M/PCIe/SSE2
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
ERROR: create: Cannot create config directory!
   At: editor/editor_settings.cpp:693.
ERROR: save: Cannot save EditorSettings config, no valid path
   At: editor/editor_settings.cpp:861.
ERROR: save: Cannot save EditorSettings config, no valid path
   At: editor/editor_settings.cpp:861.
ERROR: save: Cannot save EditorSettings config, no valid path
   At: editor/editor_settings.cpp:861.
OPENING: /home/alan/snap/godot/x1/New Game Project (::home::alan::snap::godot::x1::New Game Project)
WARNING: initialize: Error setting locale modifiers
   At: platform/x11/os_x11.cpp:149.
WARNING: initialize: XOpenIM failed
   At: platform/x11/os_x11.cpp:184.
ERROR: save: Cannot save EditorSettings config, no valid path
   At: editor/editor_settings.cpp:861.
alan@hal:~/Development/Snappy/godot$ WARNING: initialize: XCreateIC couldn't create xic
   At: platform/x11/os_x11.cpp:361.
OpenGL ES 3.0 Renderer: GeForce GTX 980M/PCIe/SSE2
GLES3: max ubo light: 409
GLES3: max ubo reflections: 455, ubo size: 144
ARVR: Registered interface: Native mobile
ERROR: create: Cannot create config directory!
   At: editor/editor_settings.cpp:693.
EditorSettings::_get - Warning, not found: text_editor/completion/put_callhint_tooltip_below_current_line
EditorSettings::_get - Warning, not found: text_editor/completion/callhint_tooltip_offset
ERROR: set_current_tab: Indexp_current=-1 out of size (get_tab_count()=0)
   At: scene/gui/tab_container.cpp:403.
ERROR: set_current_tab: Indexp_current=-1 out of size (get_tab_count()=0)
   At: scene/gui/tab_container.cpp:403.
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f31fa95f4b0] ()
[2] /snap/godot/x1/bin/godot() [0xb27ec3] ()
[3] /snap/godot/x1/bin/godot() [0xb28df8] ()
[4] /snap/godot/x1/bin/godot() [0xb2a049] ()
[5] /snap/godot/x1/bin/godot() [0xb29678] ()
[6] /snap/godot/x1/bin/godot() [0xb2e54d] ()
[7] /snap/godot/x1/bin/godot() [0xb371f5] ()
[8] /snap/godot/x1/bin/godot() [0x1d66b61] ()
[9] /snap/godot/x1/bin/godot() [0x117d2c9] ()
[10] /snap/godot/x1/bin/godot() [0x117d7b8] ()
[11] /snap/godot/x1/bin/godot() [0x43a06c] ()
[12] /snap/godot/x1/bin/godot() [0x416032] ()
[13] /snap/godot/x1/bin/godot(main+0x7b) [0x40e82b] ()
[14] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f31fa94a830] ()
[15] /snap/godot/x1/bin/godot() [0x40e6d9] ()
-- END OF BACKTRACE --

Some of the errors are also seen in upstream issue #12997 but I’m not convinced that’s the cause of the crash.

Steps to reproduce:

On a system which supports snaps, install the godot snap from the edge channel:-

sudo snap install godot

Launch godot from the command line, start a new clean project and load the editor.
Crash!
It does seem like it’s down to the fact that there’s one binary which launches as a project management UI then re-spawns as the game editor. I’m just guessing though. I don’t see any apparmor failures or in dmesg, but if I strace I see this:

wait4(25231, 0x7fff501f7730, 0, NULL)   = -1 ECHILD (No child processes)
write(2, "[7] /snap/godot/2/bin/godot() [0"..., 44[7] /snap/godot/2/bin/godot() [0x40fcc0] ()
) = 44
pipe2([3, 4], O_CLOEXEC)                = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa985eb3bd0) = 25232
close(4)                                = 0
fcntl(3, F_SETFD, 0)                    = 0
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(3, "", 4096)                       = 0
close(3)                                = 0
wait4(25232, 0x7fff501f7730, 0, NULL)   = -1 ECHILD (No child processes)
write(2, "[8] /snap/godot/2/bin/godot() [0"..., 44[8] /snap/godot/2/bin/godot() [0x4309f8] ()
) = 44
pipe2([3, 4], O_CLOEXEC)                = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa985eb3bd0) = 25233
close(4)                                = 0
fcntl(3, F_SETFD, 0)                    = 0
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(3, "", 4096)                       = 0
close(3)                                = 0
wait4(25233, 0x7fff501f7730, 0, NULL)   = -1 ECHILD (No child processes)
write(2, "[9] /snap/godot/2/bin/godot() [0"..., 44[9] /snap/godot/2/bin/godot() [0x42f422] ()
) = 44
pipe2([3, 4], O_CLOEXEC)                = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa985eb3bd0) = 25234
close(4)                                = 0
fcntl(3, F_SETFD, 0)                    = 0
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(3, "", 4096)                       = 0
close(3)                                = 0
wait4(25234, 0x7fff501f7730, 0, NULL)   = -1 ECHILD (No child processes)
write(2, "[10] /snap/godot/2/bin/godot(mai"..., 54[10] /snap/godot/2/bin/godot(main+0x56) [0x40e806] ()
) = 54
pipe2([3, 4], O_CLOEXEC)                = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa985eb3bd0) = 25235
close(4)                                = 0
fcntl(3, F_SETFD, 0)                    = 0
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(3, "", 4096)                       = 0
close(3)                                = 0
wait4(25235, 0x7fff501f7730, 0, NULL)   = -1 ECHILD (No child processes)
write(2, "[11] /lib/x86_64-linux-gnu/libc."..., 81[11] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fa981e86830] ()
) = 81
pipe2([3, 4], O_CLOEXEC)                = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa985eb3bd0) = 25236
close(4)                                = 0
fcntl(3, F_SETFD, 0)                    = 0
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
read(3, "", 4096)                       = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=25236, si_uid=0, si_status=127, si_utime=0, si_stime=0} ---
wait4(-1, NULL, WNOHANG, NULL)          = 25236
wait4(-1, NULL, WNOHANG, NULL)          = -1 ECHILD (No child processes)
rt_sigreturn({mask=[SEGV]})             = 0
close(3)                                = 0
wait4(25236, 0x7fff501f7730, 0, NULL)   = -1 ECHILD (No child processes)
write(2, "[12] /snap/godot/2/bin/godot() ["..., 45[12] /snap/godot/2/bin/godot() [0x40e6d9] ()
) = 45
write(2, "-- END OF BACKTRACE --\n", 23-- END OF BACKTRACE --
) = 23
rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
tgkill(25110, 25110, SIGABRT)           = 0
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=25110, si_uid=0} ---
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)

To prove it’s some kind of confinement issue, run /snap/godot/current/bin/godot and it works fine.

Any ideas what I can do here?

Here’s the yaml http://bazaar.launchpad.net/~popey/+junk/godot-snap/view/head:/snap/snapcraft.yaml


#2

I tried this and saw one denial:

= AppArmor =
Time: Nov 20 08:42:50
Log: apparmor="DENIED" operation="open" profile="snap.godot.godot" name="/sys/devices/pci0000:00/0000:00:02.0/revision" pid=4224 comm="godot" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
File: /sys/devices/pci0000:00/0000:00:02.0/revision (read)
Suggestions:
* adjust program to not access '/sys/devices/pci0000:00/0000:00:02.0/revision'
* adjust program to not access '/sys/devices/pci[0-9]*:[0-9]*/[0-9]*:[0-9]*:[0-9]*.[0-9]*/revision'

If I add a rule to the policy, it still dies though:

WARNING: initialize: Error setting locale modifiers
   At: platform/x11/os_x11.cpp:149.
WARNING: initialize: XOpenIM failed
   At: platform/x11/os_x11.cpp:184.
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
ERROR: initialize: Could not obtain an OpenGL 3.3 context!
   At: platform/x11/context_gl_x11.cpp:161.
WARNING: initialize: XCreateIC couldn't create xic
   At: platform/x11/os_x11.cpp:361.
ERROR: initialize: Error initializing GLAD
   At: drivers/gles3/rasterizer_gles3.cpp:146.
ERROR: initialize: Your system's graphic drivers seem not to support OpenGL 3.3 / OpenGL ES 3.0, sorry :(
Try a drivers update, buy a new GPU or try software rendering on Linux; Godot will now crash with a segmentation fault.
   At: drivers/gles3/rasterizer_gles3.cpp:156.
**ERROR** OS_Unix::execute - Could not create child process while executing: xmessage
OpenGL ES 3.0 Renderer: 
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f9ac1e334b0] ()
-- END OF BACKTRACE --
Aborted (core dumped)

It seems that the snap isn’t finding the required gl libraries (at least here).


#3

FYI> sent up a fix for the denial here: https://github.com/snapcore/snapd/pull/4257


#4

I have fixed that. It now crashes in the same way on Intel and nVidia. :slight_smile:


#5

I tried again without connecting mount-observe or fixing the above denial I see and it doesn’t crash on 17.10 with gnome-shell/wayland. Perhaps you can launch the snap with:

$ sudo strace -u <your username> -e '!select,_newselect,clock_gettime' -f -D -vv -o ./godot.trace /snap/bin/godot

and attach the trace file?


#6

Btw, this suggests to me an nvidia issue-- I’m using 2.29.4 from beta with Intel.


#7

Uh. I just tested with beta (so snapd 2.29.4) on Intel / Wayland / GNOME-Shell and it crashes reliably.

Trace from the nvidia 16.04 machine http://people.canonical.com/~alan/nvidia_godot.trace.gz
Trace from the Intel 17.10/wayland machine http://people.canonical.com/~alan/intel_godot.trace.gz


#8
6690  stat("/snap/godot/6/usr/sbin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/snap/godot/6/usr/bin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/snap/godot/6/sbin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/snap/godot/6/bin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/usr/local/sbin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/usr/local/bin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/usr/sbin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/usr/bin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/sbin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/bin/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/usr/games/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  stat("/usr/local/games/addr2line", 0x7ffc2a0571a0) = -1 ENOENT (No such file or directory)
6690  write(2, "sh: 1: ", 7)            = 7
6690  write(2, "addr2line: not found", 20) = 20
6690  write(2, "\n", 1)                 = 1
6690  dup2(10, 2)                       = 2
6690  close(10)                         = 0
6690  exit_group(127)                   = ?
6684  <... read resumed> "", 4096)      = 0
6690  +++ exited with 127 +++
6684  --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=6690, si_uid=1000, si_status=127, si_utime=0, si_stime=0} ---
6684  wait4(-1, NULL, WNOHANG, NULL)    = 6690
6684  wait4(-1, NULL, WNOHANG, NULL)    = -1 ECHILD (No child processes)
6684  rt_sigreturn({mask=[SEGV]})       = 0
6684  close(11)                         = 0
6684  wait4(6690, 0x7f0b1826b2b0, 0, NULL) = -1 ECHILD (No child processes)
6684  write(2, "[6] /lib/x86_64-linux-gnu/libc.s"..., 68) = 68
6684  write(2, "-- END OF BACKTRACE --\n", 23) = 23
6684  rt_sigprocmask(SIG_UNBLOCK, [ABRT], NULL, 8) = 0
6684  tgkill(6669, 6684, SIGABRT)       = 0
6684  --- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=6669, si_uid=1000} ---
6681  <... nanosleep resumed> )         = ? <unavailable>

Your snap forks a child which tries to exec addr2line, it can’t find it, the child goes away, the parent sees that the child isn’t around and aborts.


#9

Note that when I run this, it doesn’t crash. The Project Manager is launched, but the Project List is empty so there is nothing to ‘Run’. I don’t know godot, but it seems like this isn’t a security policy issue.


#10

Follow these steps to create a crash.

Click “New Project”, click “Create folder” and then “Create”

You’ll get a splash screen…

Then briefly the editor appears, then dies.

This is what you will see briefly.


#11

Ok, will debug further, thanks.


#12

Did you manage to make godot work in the end?

The 3.0 final release was just announced yesterday, and the snap is still on alpha and not visible to find yet.


#13

No. I noticed the release announcement yesterday and will take another look.


#14

Looks like this is now fixed in snapd 2.32. I’ve put out a call for testing.