Bug 409580 - Cantor crashes upon python2 backend interruption after showing the Mayavi demo
Summary: Cantor crashes upon python2 backend interruption after showing the Mayavi demo
Status: RESOLVED FIXED
Alias: None
Product: cantor
Classification: Applications
Component: python2-backend (show other bugs)
Version: 19.04
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Cantor Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-07 12:39 UTC by vialav
Modified: 2019-07-08 21:03 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vialav 2019-07-07 12:39:36 UTC
SUMMARY
Cantor crashes upon python2 backend interruption after showin the Mayavi demo

PREVIOUS BUGS:
Bug 409288, Bug 409523, Bug 409520 _(at the moment me is undecided about the cause)_

STEPS TO REPRODUCE
1. Compile the latest Cantor sources
2. Disable image integration for the python backend, as suggested in Bug 409523
3. Try Mayavi2's demo: 
``` python
# Create the data.
from numpy import pi, sin, cos, mgrid
dphi, dtheta = pi/250.0, pi/250.0
[phi,theta] = mgrid[0:pi+dphi*1.5:dphi,0:2*pi+dtheta*1.5:dtheta]
m0 = 4; m1 = 3; m2 = 2; m3 = 3; m4 = 6; m5 = 2; m6 = 6; m7 = 4;
r = sin(m0*phi)**m1 + cos(m2*phi)**m3 + sin(m4*theta)**m5 + cos(m6*theta)**m7
x = r*sin(phi)*cos(theta)
y = r*cos(phi)
z = r*sin(phi)*sin(theta)

# View it.
from mayavi import mlab
s = mlab.mesh(x, y, z)
mlab.show()
```
_(equivalent to running `env QT_ALL=pyside2 ETS_BACKEND=qt4 gdb cantor` under the debugger; yes `qt4` is confusing as it means in the ETS language either of both Qt4 or Qt5, so don't change it)_

Everything works so far. Then close the VTK/Mayavi window, Cantor is still "Running…". Now interrupt the [python2] backend.

OBSERVED RESULT
Cantor crashed with the following gdb-backtrace:

EXPECTED RESULT
The backend interruption.

SOFTWARE/OS VERSIONS
as reported earlier
Comment 1 vialav 2019-07-07 12:42:10 UTC
ah, forgot the backtrace:

#dmesg:
[Sun Jul  7 01:08:56 2019] cantor_python2s[23918]: segfault at 8 ip 00007ffff78e5440 sp 00007fffffffc708 error 4 in libpython2.7.so.1.0[7ffff77b4000+2e2000]

#journalctl:
Jul 07 15:26:46 linux kernel: cantor_python2s[23918]: segfault at 8 ip 00007ffff78e5440 sp 00007fffffffc708 error 4 in libpython2.7.so.1.0[7ffff77b4000+2e2000]

#gdb:
─── Output/messages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/16/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/22/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/24/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/32/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/48/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/64/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/128/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/8x8/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/16x16/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/16x16/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/24x24/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/24x24/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/32x32/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/32x32/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/48x48/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/48x48/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/256x256/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/512x512/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/scalable/ui/"
[Detaching after fork from child process 23683]
[Detaching after fork from child process 23684]
[Detaching after fork from child process 23685]
[Detaching after fork from child process 23686]
[Detaching after fork from child process 23687]
[Detaching after fork from child process 23688]
[Detaching after fork from child process 23693]
[Detaching after fork from child process 23695]
[Detaching after fork from child process 23718]
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
[Detaching after fork from child process 23819]

Thread 1 "cantor" received signal SIGPIPE, Broken pipe.
__GI___libc_write (nbytes=6, buf=0x55555611acd8, fd=26) at ../sysdeps/unix/sysv/linux/write.c:26
26	../sysdeps/unix/sysv/linux/write.c: No such file or directory.
─── Assembly ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
0x00007ffff5d9c04d __GI___libc_write+13 mov    %eax,%r8d
0x00007ffff5d9c050 __GI___libc_write+16 mov    $0x1,%eax
0x00007ffff5d9c055 __GI___libc_write+21 syscall 
0x00007ffff5d9c057 __GI___libc_write+23 cmp    $0xfffffffffffff000,%rax
0x00007ffff5d9c05d __GI___libc_write+29 ja     0x7ffff5d9c094 <__GI___libc_write+132>
0x00007ffff5d9c05f __GI___libc_write+31 mov    %r8d,%edi
0x00007ffff5d9c062 __GI___libc_write+34 mov    %rax,0x8(%rsp)
─── Expressions ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── History ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Memory ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Registers ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   rax 0xffffffffffffffe0    rbx 0x000000000000001a    rcx 0x00007ffff5d9c057    rdx 0x0000000000000006    rsi 0x000055555611acd8    rdi 0x000000000000001a    rbp 0x000055555611acd8    rsp 0x00007fffffffbe20
─── Output/messages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/16/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/22/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/24/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/32/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/48/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/64/"
Invalid Context= "stock" line for icon theme:  "/usr/share/icons/ubuntu-mono-dark/stock/128/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/8x8/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/16x16/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/16x16/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/22x22/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/24x24/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/24x24/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/32x32/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/32x32/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/48x48/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/48x48/ui/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/256x256/legacy/"
Invalid Context= "Legacy" line for icon theme:  "/usr/share/icons/Adwaita/512x512/legacy/"
Invalid Context= "UI" line for icon theme:  "/usr/share/icons/Adwaita/scalable/ui/"
[Detaching after fork from child process 23902]
[Detaching after fork from child process 23903]
[Detaching after fork from child process 23904]
[Detaching after fork from child process 23905]
[Detaching after fork from child process 23906]
[Detaching after fork from child process 23907]
[Detaching after fork from child process 23908]
[Detaching after fork from child process 23918]
[Detaching after fork from child process 23947]

Thread 1 "cantor" received signal SIGPIPE, Broken pipe.
__GI___libc_write (nbytes=6, buf=0x555556021498, fd=26) at ../sysdeps/unix/sysv/linux/write.c:26
26	../sysdeps/unix/sysv/linux/write.c: No such file or directory.
─── Assembly ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
0x00007ffff5d9c04d __GI___libc_write+13 mov    %eax,%r8d
0x00007ffff5d9c050 __GI___libc_write+16 mov    $0x1,%eax
0x00007ffff5d9c055 __GI___libc_write+21 syscall 
0x00007ffff5d9c057 __GI___libc_write+23 cmp    $0xfffffffffffff000,%rax
0x00007ffff5d9c05d __GI___libc_write+29 ja     0x7ffff5d9c094 <__GI___libc_write+132>
0x00007ffff5d9c05f __GI___libc_write+31 mov    %r8d,%edi
0x00007ffff5d9c062 __GI___libc_write+34 mov    %rax,0x8(%rsp)
─── Expressions ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── History ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Memory ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─── Registers ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   rax 0xffffffffffffffe0    rbx 0x000000000000001a    rcx 0x00007ffff5d9c057    rdx 0x0000000000000006    rsi 0x0000555556021498    rdi 0x000000000000001a    rbp 0x0000555556021498    rsp 0x00007fffffffbe20
    r8 0x0000000000000000     r9 0x0000000000000006    r10 0x0000000000000022    r11 0x0000000000000293    r12 0x0000000000000006    r13 0x000000000000001a    r14 0x0000555555ff50f0    r15 0x0000555555ff50f0
   rip 0x00007ffff5d9c057 eflags [ CF AF SF IF ]        cs 0x00000033             ss 0x0000002b             ds 0x00000000             es 0x00000000             fs 0x00000000             gs 0x00000000        
─── Source ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Cannot display "/build/glibc-KRRWSm/glibc-2.29/io/../sysdeps/unix/sysv/linux/write.c" ([Errno 2] No such file or directory: '/build/glibc-KRRWSm/glibc-2.29/io/../sysdeps/unix/sysv/linux/write.c')
─── Stack ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[0] from 0x00007ffff5d9c057 in __GI___libc_write+23 at ../sysdeps/unix/sysv/linux/write.c:26
arg nbytes = 6
arg buf = 0x555556021498
arg fd = 26
[1] from 0x00007ffff5d9c057 in __GI___libc_write+23 at ../sysdeps/unix/sysv/linux/write.c:24
arg fd = 26
arg buf = 0x555556021498
arg nbytes = 6
[+]
─── Threads ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[6] id 23900 name cantor:disk$0 from 0x00007ffff5c773bb in futex_wait_cancelable+27 at ../sysdeps/unix/sysv/linux/futex-internal.h:88
[5] id 23898 name QDBusConnection from 0x00007ffff5da0729 in __GI___poll+73 at ../sysdeps/unix/sysv/linux/poll.c:29
[4] id 23897 name gdbus from 0x00007ffff5da0729 in __GI___poll+73 at ../sysdeps/unix/sysv/linux/poll.c:29
[3] id 23896 name gmain from 0x00007ffff5da0729 in __GI___poll+73 at ../sysdeps/unix/sysv/linux/poll.c:29
[2] id 23895 name QXcbEventReader from 0x00007ffff5da0729 in __GI___poll+73 at ../sysdeps/unix/sysv/linux/poll.c:29
[1] id 23890 name cantor from 0x00007ffff5d9c057 in __GI___libc_write+23 at ../sysdeps/unix/sysv/linux/write.c:26
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
>>> bt
#0  0x00007ffff5d9c057 in __GI___libc_write (nbytes=6, buf=0x555556021498, fd=26) at ../sysdeps/unix/sysv/linux/write.c:26
#1  0x00007ffff5d9c057 in __GI___libc_write (fd=26, buf=0x555556021498, nbytes=6) at ../sysdeps/unix/sysv/linux/write.c:24
#2  0x00007ffff628f421 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#3  0x00007ffff6285218 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007ffff628ff88 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007ffff6285abb in QProcess::waitForFinished(int) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007fffe0024a12 in PythonSession::logout() () at /usr/lib/x86_64-linux-gnu/libcantor_pythonbackend.so
#7  0x00007fffe0021c7c in PythonSession::reportServerProcessError(QProcess::ProcessError) () at /usr/lib/x86_64-linux-gnu/libcantor_pythonbackend.so
#8  0x00007ffff633875f in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#9  0x00007ffff62842c1 in QProcess::errorOccurred(QProcess::ProcessError) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00007ffff628afce in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#11 0x00007ffff628b149 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00007ffff6338645 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff6344ac8 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#14 0x00007ffff6344e92 in QSocketNotifier::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#15 0x00007ffff708783c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#16 0x00007ffff708f104 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#17 0x00007ffff63099c8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff63635dd in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#19 0x00007ffff32ae48e in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007ffff32ae728 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007ffff32ae7c0 in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#22 0x00007ffff636297f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#23 0x00007ffff63079fa in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#24 0x00007ffff6310aa4 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#25 0x0000555555563084 in  ()
#26 0x00007ffff5cb5b6b in __libc_start_main (main=0x5555555623c0, argc=1, argv=0x7fffffffcb38, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7fffffffcb28) at ../csu/libc-start.c:308
#27 0x000055555556388a in  ()
>>>
Comment 2 Nikita Sirgienko 2019-07-08 19:23:27 UTC
Wrong confirmation, mayavi crash python2 in my system by itself, even in interpteter.
I have tested this code in python3, all works fine, (with disable image integration). Entry with `show` command have finished after closing mayavi plot windows as expected.
There is possibility, that Cantor behaviour, which you have discribed, the result of wrong crash handling. I have improved the handling, so could you tests this code with python3 and python2?
Comment 3 vialav 2019-07-08 21:03:20 UTC
Thank you, yes, the behaviour has definitely improved under both Pythons 2/3. There is no crash either if I interrupt the backend prematurely, as it has been the reported case (see also below), or after auto-moving the data to the Variable Manager window has been finalized. 

There is a lag, indeed, between closing the VTK/Mayavi window and Cantor returning to its original readiness, which I had wrongly assumed as a hang on 'Calculating…'. If I had waited for longer, possibly, I wouldn't have hit the present bug :)

Auto-reloading the Var Manager, also upon walking over the tabs, contributes to a lag, especially with such big data, see to this my comment in Bug 409520 #3  in the past. There may be a room for rethinking the Var Manager implementation, as a suggestion. 

Closing as resolved, and thank you for looking into this matter.