After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 608751 - [assrender] Random crashes because libass is not threadsafe
[assrender] Random crashes because libass is not threadsafe
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 0.10.18
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-02-02 00:27 UTC by Eric Appleman
Modified: 2010-02-23 17:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Dependencies (573 bytes, text/plain)
2010-02-02 00:28 UTC, Eric Appleman
  Details
Disassembly (947 bytes, text/plain)
2010-02-02 00:28 UTC, Eric Appleman
  Details
ProcMaps (51.99 KB, text/plain)
2010-02-02 00:29 UTC, Eric Appleman
  Details
ProcStatus (775 bytes, text/plain)
2010-02-02 00:30 UTC, Eric Appleman
  Details
Registers (469 bytes, text/plain)
2010-02-02 00:31 UTC, Eric Appleman
  Details
Stacktrace (19.71 KB, text/plain)
2010-02-02 00:32 UTC, Eric Appleman
  Details
ThreadStacktrace (29.08 KB, text/plain)
2010-02-02 00:32 UTC, Eric Appleman
  Details
XsessionErrors (149.95 KB, text/plain)
2010-02-02 00:32 UTC, Eric Appleman
  Details
gdb segfault (1.50 KB, text/x-log)
2010-02-02 16:36 UTC, Eric Appleman
  Details
gdb backtrace (890 bytes, text/plain)
2010-02-02 16:52 UTC, Eric Appleman
  Details
gdb backtrace (proper) (3.79 KB, text/plain)
2010-02-02 16:55 UTC, Eric Appleman
  Details
Another backtrace with multiple segfaults (10.29 KB, text/plain)
2010-02-14 02:36 UTC, Eric Appleman
  Details
thread apply all bt (98.29 KB, text/plain)
2010-02-23 16:35 UTC, Eric Appleman
  Details
assrender: Protect libass structures from concurrent access from multiple threads (6.03 KB, patch)
2010-02-23 17:17 UTC, Sebastian Dröge (slomo)
committed Details | Review

Description Eric Appleman 2010-02-02 00:27:56 UTC
I'll fill this later.

ProblemType: Crash
Architecture: i386
CheckboxSubmission: b8398b21075a3a8723b2ba20478c4f9e
CheckboxSystem: 703a6ca1eefae989daaf40c6bb6aa94a
CrashCounter: 1
Date: Mon Feb 1 13:09:22 2010
DistroRelease: Ubuntu 10.04
ExecutablePath: /usr/bin/totem
InstallationMedia: Ubuntu 10.04 "Lucid Lynx" - Alpha i386 (20091209)
Package: libgstreamer0.10-0 0.10.25.2-2ubuntu1
ProcCmdline: totem
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.32-12.16-genusername
SegvAnalysis:
 Segfault happened at: 0x66d5ec1 <*__GI___libc_free+49>: mov 0x4(%edx),%eax
 PC (0x066d5ec1) ok
 source "0x4(%edx)" (0x00000808) not located in a known VMA region (needed readable region)!
 destination "%eax" ok
SegvReason: reading NULL VMA
Signal: 11
SourcePackage: gstreamer0.10
StacktraceTop:
 *__GI___libc_free (mem=0x80c) at malloc.c:3709
 ass_clear_fonts (priv=0x9ae8b78) at ass_library.c:123
 ass_library_done (priv=0x9ae8b78) at ass_library.c:53
 gst_ass_render_finalize (object=0x9ae60c0)
 IA__g_object_unref (_object=0x9ae60c0)
Title: totem crashed with SIGSEGV in *__GI___libc_free()
Uname: Linux 2.6.32-12-generic i686
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare
Comment 1 Eric Appleman 2010-02-02 00:28:22 UTC
Created attachment 152793 [details]
Dependencies
Comment 2 Eric Appleman 2010-02-02 00:28:49 UTC
Created attachment 152794 [details]
Disassembly
Comment 3 Eric Appleman 2010-02-02 00:29:57 UTC
Created attachment 152795 [details]
ProcMaps
Comment 4 Eric Appleman 2010-02-02 00:30:38 UTC
Created attachment 152796 [details]
ProcStatus
Comment 5 Eric Appleman 2010-02-02 00:31:59 UTC
Created attachment 152797 [details]
Registers
Comment 6 Eric Appleman 2010-02-02 00:32:17 UTC
Created attachment 152798 [details]
Stacktrace
Comment 7 Eric Appleman 2010-02-02 00:32:41 UTC
Created attachment 152799 [details]
ThreadStacktrace
Comment 8 Eric Appleman 2010-02-02 00:32:59 UTC
Created attachment 152800 [details]
XsessionErrors
Comment 9 Sebastian Dröge (slomo) 2010-02-02 07:58:41 UTC
Do you have a way to reproduce this? Would be good to get a complete backtrace without optimizations or even a valgrind log... this looks like a libass issue IMHO.
Comment 10 Eric Appleman 2010-02-02 14:05:37 UTC
Reproducing is as simple as opening an MKV file that contains an ASS track in Totem. I believe it is a regression brought on by a commit to -base in November since I recall from a few weeks ago that bad git + base 0.10.25.0 doesn't trigger the issue. Of course, that combination doesn't allow styled subtitles to work in Totem. I'll try narrow down the offending commit again since I have forgot.

Also, this bug doesn't occur when running an MKV file with ASS through playbin2.
Comment 11 Eric Appleman 2010-02-02 14:07:41 UTC
BTW, here's a valgrind log.

http://www.mediafire.com/?zzjlmywnz3z
Comment 12 Sebastian Dröge (slomo) 2010-02-02 14:30:55 UTC
(In reply to comment #10)
> Reproducing is as simple as opening an MKV file that contains an ASS track in
> Totem. I believe it is a regression brought on by a commit to -base in November
> since I recall from a few weeks ago that bad git + base 0.10.25.0 doesn't
> trigger the issue. Of course, that combination doesn't allow styled subtitles
> to work in Totem. I'll try narrow down the offending commit again since I have
> forgot.

Do you have this with every MKV file containing ASS tracks? I can't reproduce this here with GIT and totem 2.29.6... also the valgrind log is not very useful, it doesn't contain any segfaults :(
Comment 13 Eric Appleman 2010-02-02 16:36:00 UTC
Ever since last night's removal of ass_set_fonts_dir, I'm noticing that Totem no longer hangs or crashes every single time I load a MKV file. Instead now, it will sometimes load the file properly on the first attempt when using "Open", but if doesn't succeed for whatever reason, it may load on the second attempt when using "Open" again. If Totem again fails to load the file, I get the output below.
Comment 14 Eric Appleman 2010-02-02 16:36:50 UTC
Created attachment 152848 [details]
gdb segfault
Comment 15 Sebastian Dröge (slomo) 2010-02-02 16:42:43 UTC
(In reply to comment #14)
> Created an attachment (id=152848) [details]
> gdb segfault

Could you also get a backtrace? :)
Comment 16 Eric Appleman 2010-02-02 16:52:03 UTC
Backtrace attached (hope I logged it properly).

BTW, I'll try to get a valgrind that contains a segfault. It's harder to trigger through valgrind than through gdb.
Comment 17 Eric Appleman 2010-02-02 16:52:23 UTC
Created attachment 152852 [details]
gdb backtrace
Comment 18 Eric Appleman 2010-02-02 16:54:50 UTC
And I did do it wrong...

Proper backtrace attached.
Comment 19 Eric Appleman 2010-02-02 16:55:10 UTC
Created attachment 152853 [details]
gdb backtrace (proper)
Comment 20 Sebastian Dröge (slomo) 2010-02-05 17:05:49 UTC
This looks very much like a libass, freetype or configuration problem. The same file works fine with other players that use the same libass version?
Comment 21 Eric Appleman 2010-02-05 23:35:39 UTC
mplayer git, libass tests, and vlc git all handle the files properly.

playbin2, as of the latest commits to bad, is doing quite well too.

This problem is restricted to Totem's handling of the  aforementioned files.
Comment 22 Sebastian Dröge (slomo) 2010-02-06 17:34:27 UTC
Ok, no idea then... hm, would really help if I could reproduce it here or if you could get a valgrind log of the crash.
Comment 23 Grigori 2010-02-10 12:47:50 UTC
I'm unable to reproduce this with current -base, -good, -bad and -ffmpeg plus Ubuntu 9.10's Totem.

Still, maybe there is a problem... I'm not sure how threads are used in gstreamer, please make sure that only one thread at a time uses a ass_renderer or ass_track. libass is reentrant but doesn't do any locking on its objects by itself.
Comment 24 Eric Appleman 2010-02-14 02:35:27 UTC
I'm getting a multitude of distinct, yet related segfault errors all triggered by the file loading.
Comment 25 Eric Appleman 2010-02-14 02:36:25 UTC
Created attachment 153744 [details]
Another backtrace with multiple segfaults
Comment 26 Eric Appleman 2010-02-14 02:54:00 UTC
Here's a Valgrind with FreeType marking the start of the crash.
Comment 27 Eric Appleman 2010-02-14 02:54:36 UTC
http://www.mediafire.com/?xz3lmnhgzxe
Comment 28 Eric Appleman 2010-02-23 06:51:16 UTC
Is there anything else I can provide that would help get this bug a closer look before the next bad release?
Comment 29 Tim-Philipp Müller 2010-02-23 09:13:53 UTC
(In reply to comment #25)
> Created an attachment (id=153744) [details]
> Another backtrace with multiple segfaults

A single 'thread apply all bt' stack trace might be more useful.
Comment 30 Eric Appleman 2010-02-23 16:34:42 UTC
Let each instance of a file being loaded represent a separate trace.
Comment 31 Eric Appleman 2010-02-23 16:35:28 UTC
Created attachment 154512 [details]
thread apply all bt
Comment 32 Sebastian Dröge (slomo) 2010-02-23 17:17:34 UTC
Created attachment 154519 [details] [review]
assrender: Protect libass structures from concurrent access from multiple threads

Fixes bug #608751.
Comment 33 Sebastian Dröge (slomo) 2010-02-23 17:19:04 UTC
commit 0dbe95a97d553635c21b476f7206da4bf2bee652
Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
Date:   Tue Feb 23 18:16:48 2010 +0100

    assrender: Protect libass structures from concurrent access from multiple th
    
    Fixes bug #608751.