xpra icon
Bug tracker and wiki

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#462 closed defect (invalid)

x264 encoder threading related memory corruption and crash

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: critical Milestone: 0.11
Component: server Version:
Keywords: Cc:

Description (last modified by Antoine Martin)

Hard to reproduce:

  • start server
  • connect client and use "x264" encoder (use XPRA_ENCODER_TYPE=x264 xpra start ... if needed to force "x264" instead of "nvenc")
  • disconnect the client
  • xpra info the server in a loop until it crashes with:
    *** Error in `/bin/python': double free or corruption (!prev): 0x0000000003c9d3f0 ***
    ======= Backtrace: =========
    /lib64/libc.so.6[0x345287d0b8]
    /lib64/libGL.so.1[0x39682ad0ac]
    ======= Memory map: ========
    00400000-00401000 r-xp 00000000 09:7f 30149                              /usr/bin/python2.7
    00600000-00601000 r--p 00000000 09:7f 30149                              /usr/bin/python2.7
    00601000-00602000 rw-p 00001000 09:7f 30149                              /usr/bin/python2.7
    02602000-043ca000 rw-p 00000000 00:00 0                                  [heap]
    200000000-800000000 ---p 00000000 00:00 0 
    ...
    

gdb shows:

Program received signal SIGABRT, Aborted.
0x00000034528359e9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
(gdb) bt
#0  0x00000034528359e9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x00000034528370f8 in __GI_abort () at abort.c:90
#2  0x0000003452875d17 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x345297e568 "*** Error in `%s': %s: 0x%s ***\n")
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:196
#3  0x000000345287d0b8 in malloc_printerr (ptr=<optimized out>, str=0x345297e640 "double free or corruption (!prev)", action=3) at malloc.c:4937
#4  _int_free (av=0x3452bba780 <main_arena>, p=<optimized out>, have_lock=0) at malloc.c:3789
#5  0x00000039682ad0ac in ?? () from /lib64/libGL.so.1
#6  0x000000396580117a in ?? () from /lib64/tls/libnvidia-tls.so.319.49
#7  0x0000003453d08176 in PyThread_start_new_thread () from /lib64/libpython2.7.so.1.0
#8  0x0000003453d0c117 in ?? () from /lib64/libpython2.7.so.1.0
#9  0x0000003453cddcee in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#10 0x0000003453cdd80c in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#11 0x0000003453cdec7d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#12 0x0000003453c6dca0 in ?? () from /lib64/libpython2.7.so.1.0
#13 0x0000003453c49dd3 in PyObject_Call () from /lib64/libpython2.7.so.1.0
#14 0x0000003453cd8af7 in PyEval_CallObjectWithKeywords () from /lib64/libpython2.7.so.1.0
#15 0x00007fbbeb778709 in _pyglib_handler_marshal (user_data=0x3d19a28) at pyglib.c:532
#16 0x0000003454c47e06 in g_main_dispatch (context=0x2e2d740) at gmain.c:3054
#17 g_main_context_dispatch (context=context@entry=0x2e2d740) at gmain.c:3630
#18 0x0000003454c48158 in g_main_context_iterate (context=0x2e2d740, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3701
#19 0x0000003454c4855a in g_main_loop_run (loop=0x3c58c90) at gmain.c:3895
#20 0x00000039e353edf7 in gtk_main () from /lib64/libgtk-x11-2.0.so.0
#21 0x00007fbbea7fec27 in _wrap_gtk_main () from /usr/lib64/python2.7/site-packages/gtk-2.0/gtk/_gtk.so
#22 0x0000003453cddabc in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#23 0x0000003453cdd80c in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#24 0x0000003453cdec7d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#25 0x0000003453cdd769 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#26 0x0000003453cdec7d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#27 0x0000003453cdd769 in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#28 0x0000003453cdd80c in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#29 0x0000003453cdd80c in PyEval_EvalFrameEx () from /lib64/libpython2.7.so.1.0
#30 0x0000003453cdec7d in PyEval_EvalCodeEx () from /lib64/libpython2.7.so.1.0
#31 0x0000003453cded82 in PyEval_EvalCode () from /lib64/libpython2.7.so.1.0
#32 0x0000003453cf78af in ?? () from /lib64/libpython2.7.so.1.0
#33 0x0000003453cf89ce in PyRun_FileExFlags () from /lib64/libpython2.7.so.1.0
#34 0x0000003453cf9b39 in PyRun_SimpleFileExFlags () from /lib64/libpython2.7.so.1.0
#35 0x0000003453d0a66f in Py_Main () from /lib64/libpython2.7.so.1.0
#36 0x0000003452821b45 in __libc_start_main (main=0x4006f0, argc=7, ubp_av=0x7fff73250888, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fff73250878) at libc-start.c:274
#37 0x0000000000400721 in ?? ()
#38 0x00007fff73250878 in ?? ()
#39 0x000000000000001c in ?? ()
#40 0x0000000000000007 in ?? ()
#41 0x00007fff732510b6 in ?? ()
#42 0x00007fff732510c2 in ?? ()
#43 0x00007fff732510d0 in ?? ()
#44 0x00007fff732510d6 in ?? ()
#45 0x00007fff732510da in ?? ()
#46 0x00007fff732510e6 in ?? ()

Turning off x264 threading seems to prevent the crash:

XPRA_X264_THREADS=1 xpra ...

So we should probably make this the default.

Note: the value of "1" forces x264 to use a single thread, "0" means auto and other positive values specify the number of threads exactly.

What does bother me though is the presence of:

/lib64/tls/libnvidia-tls.so.319.49

in the PyThread_start_new_thread call stack. I hope this isn't caused by nvidia drivers. (we have enough TLS problems already)

Change History (1)

comment:1 Changed 6 years ago by Antoine Martin

Description: modified (diff)
Resolution: invalid
Status: newclosed
  • cannot reproduce on Fedora 20 (no nvidia drivers installed)
  • cannot reproduce with latest nvidia drivers (3.31.20)

Was probably a bug in the Nvidia driver's TLS code. Closing.

Last edited 6 years ago by Antoine Martin (previous) (diff)
Note: See TracTickets for help on using tickets.