Closed Bug 1127752 Opened 9 years ago Closed 9 years ago

Crashes in GTK3 builds when OMTC is enabled

Categories

(Core :: Graphics: Layers, defect)

37 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: anakin.cs, Assigned: lsalzman)

References

Details

(Whiteboard: gfx-noted)

Attachments

(1 file, 9 obsolete files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0
Build ID: 20150130004739

Steps to reproduce:

I'm on ArchLinux 64bit with a package from https://bbs.archlinux.org/viewtopic.php?id=117157
I'm using firefox dev edition and it started crashing after the package maintainer enabled GTK3.
It may be related to gfx.canvas.azure.backends (=skia), layers.acceleration.force-enabled(=true) and layers.offmainthreadcomposition.enabled(=true), although I haven't tried to find which one yet.


Actual results:

#0  0x00007f0c16e990d9 in raise () from /usr/lib/libpthread.so.0                                                                                                                                                                         
#1  0x00007f0c0967eaa0 in nsProfileLock::FatalSignalHandler(int, siginfo_t*, void*) () from /usr/lib/firefox-developer-edition/libxul.so                                                                                                     
#2  <signal handler called>                                                                                                                                                                                                                     
#3  0x00007f0c13eefec0 in cairo_new_path () from /usr/lib/libcairo.so.2                                                                                                                                                                             
#4  0x00007f0c0a4cf16e in moz_gtk_widget_paint () from /usr/lib/firefox-developer-edition/libxul.so                                                                                                                                                     
#5  0x00007f0c0a4d61c7 in nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext*, nsIFrame*, unsigned char, nsRect const&, nsRect const&) ()                                                                                                             
   from /usr/lib/firefox-developer-edition/libxul.so
#6  0x00007f0c09f119a9 in nsCSSRendering::PaintBackgroundWithSC(nsPresContext*, nsRenderingContext&, nsIFrame*, nsRect const&, nsRect const&, nsStyleContext*, nsStyleBorder const&, unsigned int, nsRect*, int) () from /usr/lib/firefox-developer-edition/libxul.so
#7  0x00007f0c09f10f5a in nsCSSRendering::PaintBackground(nsPresContext*, nsRenderingContext&, nsIFrame*, nsRect const&, nsRect const&, unsigned int, nsRect*, int) ()
   from /usr/lib/firefox-developer-edition/libxul.so
#8  0x00007f0c0a51001a in nsButtonFrameRenderer::PaintBorderAndBackground(nsPresContext*, nsRenderingContext&, nsRect const&, nsRect const&, unsigned int) ()
   from /usr/lib/firefox-developer-edition/libxul.so
#9  0x00007f0c0a50ff8f in nsDisplayButtonBorderBackground::Paint(nsDisplayListBuilder*, nsRenderingContext*) () from /usr/lib/firefox-developer-edition/libxul.so
#10 0x00007f0c09ed4fb5 in mozilla::FrameLayerBuilder::PaintItems(nsTArray<mozilla::FrameLayerBuilder::ClippedDisplayItem>&, nsIntRect const&, gfxContext*, nsRenderingContext*, nsDisplayListBuilder*, nsPresContext*, nsIntPoint const&, float, float, int) () from /usr/lib/firefox-developer-edition/libxul.so
#11 0x00007f0c09ed3cab in mozilla::FrameLayerBuilder::DrawPaintedLayer(mozilla::layers::PaintedLayer*, gfxContext*, nsIntRegion const&, mozilla::layers::DrawRegionClip, nsIntRegion const&, void*) () from /usr/lib/firefox-developer-edition/libxul.so
#12 0x00007f0c087251b8 in mozilla::layers::ClientPaintedLayer::PaintThebes() () from /usr/lib/firefox-developer-edition/libxul.so
#13 0x00007f0c08726cfd in mozilla::layers::ClientPaintedLayer::RenderLayerWithReadback(mozilla::layers::ReadbackProcessor*) () from /usr/lib/firefox-developer-edition/libxul.so
#14 0x00007f0c08729f37 in mozilla::layers::ClientContainerLayer::RenderLayer() () from /usr/lib/firefox-developer-edition/libxul.so
#15 0x00007f0c08729f37 in mozilla::layers::ClientContainerLayer::RenderLayer() () from /usr/lib/firefox-developer-edition/libxul.so
#16 0x00007f0c08722d3a in mozilla::layers::ClientLayerManager::EndTransactionInternal(void (*)(mozilla::layers::PaintedLayer*, gfxContext*, nsIntRegion const&, mozilla::layers::DrawRegionClip, nsIntRegion const&, void*), void*, mozilla::layers::LayerManager::EndTransactionFlags) () from /usr/lib/firefox-developer-edition/libxul.so
#17 0x00007f0c08726b6e in mozilla::layers::ClientLayerManager::EndTransaction(void (*)(mozilla::layers::PaintedLayer*, gfxContext*, nsIntRegion const&, mozilla::layers::DrawRegionClip, nsIntRegion const&, void*), void*, mozilla::layers::LayerManager::EndTransactionFlags) () from /usr/lib/firefox-developer-edition/libxul.so
#18 0x00007f0c09f07ddb in nsDisplayList::PaintRoot(nsDisplayListBuilder*, nsRenderingContext*, unsigned int) () from /usr/lib/firefox-developer-edition/libxul.so
#19 0x00007f0c09efa1d6 in nsLayoutUtils::PaintFrame(nsRenderingContext*, nsIFrame*, nsRegion const&, unsigned int, unsigned int) () from /usr/lib/firefox-developer-edition/libxul.so
#20 0x00007f0c09f3115d in PresShell::Paint(nsView*, nsRegion const&, unsigned int) () from /usr/lib/firefox-developer-edition/libxul.so
#21 0x00007f0c09e2eab1 in nsViewManager::ProcessPendingUpdatesPaint(nsIWidget*) () from /usr/lib/firefox-developer-edition/libxul.so
#22 0x00007f0c09e2caf6 in nsViewManager::ProcessPendingUpdatesForView(nsView*, bool) () from /usr/lib/firefox-developer-edition/libxul.so
#23 0x00007f0c09eb4768 in nsRefreshDriver::Tick(long, mozilla::TimeStamp) () from /usr/lib/firefox-developer-edition/libxul.so
#24 0x00007f0c09287435 in nsRefreshDriver::DoTick() () from /usr/lib/firefox-developer-edition/libxul.so
#25 0x00007f0c09287517 in nsRefreshDriver::FinishedWaitingForTransaction() () from /usr/lib/firefox-developer-edition/libxul.so
#26 0x00007f0c0875179c in mozilla::layers::CompositorChild::RecvDidComposite(unsigned long const&, unsigned long const&) () from /usr/lib/firefox-developer-edition/libxul.so
#27 0x00007f0c083f2d3e in mozilla::layers::PCompositorChild::OnMessageReceived(IPC::Message const&) () from /usr/lib/firefox-developer-edition/libxul.so
#28 0x00007f0c0a3887c4 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) () from /usr/lib/firefox-developer-edition/libxul.so
#29 0x00007f0c0a388711 in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message const&) () from /usr/lib/firefox-developer-edition/libxul.so
---Type <return> to continue, or q <return> to quit---
#30 0x00007f0c0a3885eb in mozilla::ipc::MessageChannel::OnMaybeDequeueOne() () from /usr/lib/firefox-developer-edition/libxul.so
#31 0x00007f0c0a384738 in MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask const&) () from /usr/lib/firefox-developer-edition/libxul.so
#32 0x00007f0c09c77c26 in MessageLoop::DoWork() () from /usr/lib/firefox-developer-edition/libxul.so
#33 0x00007f0c0a38822b in mozilla::ipc::DoWorkRunnable::Run() () from /usr/lib/firefox-developer-edition/libxul.so
#34 0x00007f0c09c2efa8 in nsThread::ProcessNextEvent(bool, bool*) () from /usr/lib/firefox-developer-edition/libxul.so
#35 0x00007f0c09c3f75d in NS_ProcessNextEvent(nsIThread*, bool) () from /usr/lib/firefox-developer-edition/libxul.so
#36 0x00007f0c09c7982b in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) () from /usr/lib/firefox-developer-edition/libxul.so
#37 0x00007f0c0a384132 in MessageLoop::Run() () from /usr/lib/firefox-developer-edition/libxul.so
#38 0x00007f0c0a4cc7ba in nsBaseAppShell::Run() () from /usr/lib/firefox-developer-edition/libxul.so
#39 0x00007f0c0a56b6ee in nsAppStartup::Run() () from /usr/lib/firefox-developer-edition/libxul.so
#40 0x00007f0c0a57e3dc in XREMain::XRE_mainRun() () from /usr/lib/firefox-developer-edition/libxul.so
#41 0x00007f0c0a57c91c in XREMain::XRE_main(int, char**, nsXREAppData const*) () from /usr/lib/firefox-developer-edition/libxul.so
#42 0x00007f0c0a57c71f in XRE_main () from /usr/lib/firefox-developer-edition/libxul.so
#43 0x0000000000410284 in do_main(int, char**, nsIFile*) ()
#44 0x000000000040c366 in main ()
Blocks: gtk3
It would be useful to get a backtrace from a recent nightly, unfortunately that requires a build from source. The GTK3 code is not stable and building off the Aurora branch means that that build only gets changes once every 6 weeks. https://developer.mozilla.org/en-US/docs/Simple_Firefox_build
(In reply to Kevin Brosnan [:kbrosnan] from comment #1)
> It would be useful to get a backtrace from a recent nightly, unfortunately
> that requires a build from source. The GTK3 code is not stable and building
> off the Aurora branch means that that build only gets changes once every 6
> weeks. https://developer.mozilla.org/en-US/docs/Simple_Firefox_build

Wasn't the elm branch used to build GTK3 nightlies? It appears those builds were stopped early this month.
From my testing it only seems to crash when OMTC is enabled (layers.acceleration.force-enabled/layers.offmainthreadcomposition.enabled) which was already the case 3-4 months ago when the same ArchLinux package had GTK3 enabled.
Blocks: 722012
I knew about elm, the builds approaching a month old is the reason I mentioned building yourself. I suspect glandium and others have been busy.
I'm also on Arch Linux x86_64. I use Firefox 36 b6 compiled according to the script https://aur.archlinux.org/packages/firefox-gtk3 (excluding using patch mozilla-858919.patch) and with using all above mentioned settings (gfx.canvas.azure.backends (=skia), layers.acceleration.force-enabled(=true) and layers.offmainthreadcomposition.enabled(=true)) I have no crashes or any unstable work. I have built firefox with clang 3.5.1 and even used maximum optimized compilation flags for building - all is fine.
My suggestion - try to rebuild firefox from source.
(In reply to Ilya from comment #5)
> I'm also on Arch Linux x86_64. I use Firefox 36 b6 compiled according to the
> script https://aur.archlinux.org/packages/firefox-gtk3 (excluding using
> patch mozilla-858919.patch) and with using all above mentioned settings
> (gfx.canvas.azure.backends (=skia), layers.acceleration.force-enabled(=true)
> and layers.offmainthreadcomposition.enabled(=true)) I have no crashes or any
> unstable work. I have built firefox with clang 3.5.1 and even used maximum
> optimized compilation flags for building - all is fine.
> My suggestion - try to rebuild firefox from source.

layers.acceleration.force-enabled and layers.offmainthreadcomposition.enabled won't do anything if you aren't using a patch or didn't set the MOZ_USE_OMTC=1 environment variable before launching firefox.
(In reply to AnAkkk from comment #6)
> layers.acceleration.force-enabled and
> layers.offmainthreadcomposition.enabled won't do anything if you aren't
> using a patch or didn't set the MOZ_USE_OMTC=1 environment variable before
> launching firefox.

Yes, you are right! Now firefox often crashes with segmentation fault.
Summary: Random crashes in GTK3 builds → Crashes in GTK3 builds when OMTC is enabled
Component: Untriaged → Graphics: Layers
Product: Firefox → Core
I guess this is going to be a problem for the GTK3 builds now that OMTC was enabled in nightly.
Flags: needinfo?(nical.bugzilla)
Right now I am running into bug 1063359 which prevents me from getting this crash (gecko doesn't start at all). Are there non-Arch users running into this ? I ask because I Firefox on Arch is built with some specific options (using system libraries etc.), although I don't know for sure how different things are for the gtk3 build.
Flags: needinfo?(nical.bugzilla)
The build I maintain at http://pkgbuild.com/~heftig/packages/firefox-developer-edition/ also suffers from this issue. The only system lib configured is cairo (as required for cairo-gtk3).
Attached patch fixes for using Skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Attachment #8598012 - Flags: review?(jmuizelaar)
Assignee: nobody → lsalzman
Attached patch fixes for using skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Fixed a possible case where XShm might not be available.
Attachment #8598012 - Attachment is obsolete: true
Attachment #8598012 - Flags: review?(jmuizelaar)
Attachment #8598152 - Flags: review?(jmuizelaar)
Attached patch fixes for using Skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Fixed accidental debug code left in earlier patch
Attachment #8598152 - Attachment is obsolete: true
Attachment #8598152 - Flags: review?(jmuizelaar)
Attachment #8598157 - Flags: review?(jmuizelaar)
Comment on attachment 8598157 [details] [diff] [review]
fixes for using Skia and OMTC with GTK3

Review of attachment 8598157 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/2d/2D.h
@@ +883,5 @@
>  
> +  /**
> +   * Whether the current clip is either a path or anti-aliased rect.
> +   */
> +  virtual bool IsComplexClip() const { return true; }

I like HasComplexClip better because it IsComplexClip makes it seem like the we're asking whether the DrawTarget is a complex clip.

::: gfx/2d/DrawTargetSkia.cpp
@@ +163,5 @@
> +  *aData = reinterpret_cast<uint8_t*>(bitmap.getPixels());
> +  *aSize = IntSize(bitmap.width(), bitmap.height());
> +  *aStride = int32_t(bitmap.rowBytes());
> +  *aFormat = SkiaColorTypeToGfxFormat(bitmap.colorType());
> +  return true;  

There's a bunch of places where there's trailing white space in the patch. These show up really obviously in bugzilla's review view.

::: widget/gtk/nsNativeThemeGTK.cpp
@@ +744,5 @@
> +      if (aScaleFactor != 1) {
> +          dt->SetTransform(Matrix::Scaling(aScaleFactor, aScaleFactor));
> +      }
> +
> +      cairo_t* cr = (cairo_t*)dt->GetNativeSurface(NativeSurfaceType::CAIRO_CONTEXT);

We always want to use system cairo here so it should instead be something like:

cairo_t *cr = cairo_create_image_surface_for_data(...)
cairo_scale(cr, aScaleFactor);

moz_gtk_widget_paint(cr);

@@ +786,5 @@
> +          }
> +        }
> +      }
> +      
> +      dataSurface->Unmap();

I believe we should Unmap the surface before we can use it in DrawSurface or CopySurface.

@@ +984,5 @@
>    renderer.Draw(ctx, drawingRect.Size(), rendererFlags, colormap);
>  #else 
> +  DrawTarget* dt = aContext->GetDrawTarget();
> +  cairo_t *cr = (cairo_t*)dt->GetNativeSurface(NativeSurfaceType::CAIRO_CONTEXT);
> +  if (cr) {

I think we should just drop this path completely because it won't work with in-tree cairo.
Attachment #8598157 - Flags: review?(jmuizelaar) → review-
Depends on: 1159273
Attached patch fixes for using Skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Attachment #8598157 - Attachment is obsolete: true
Attachment #8598696 - Flags: review?(jmuizelaar)
Attached patch fixes for using Skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Fixed potential bug related to notification of changes to draw target, added support for Cairo xlib surfaces, and updated to work with the newer tree and system Cairo patch.
Attachment #8598696 - Attachment is obsolete: true
Attachment #8598696 - Flags: review?(jmuizelaar)
Attachment #8599416 - Flags: review?(jmuizelaar)
Attached patch fixes for using Skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Fix missing HelpersCairo.cpp
Attachment #8599416 - Attachment is obsolete: true
Attachment #8599416 - Flags: review?(jmuizelaar)
Attachment #8599582 - Flags: review?(jmuizelaar)
Attached patch fixes for using Skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Use borrowed contexts instead of GetNativeSurface
Attachment #8599582 - Attachment is obsolete: true
Attachment #8599582 - Flags: review?(jmuizelaar)
Attachment #8599938 - Flags: review?(jmuizelaar)
Comment on attachment 8599938 [details] [diff] [review]
fixes for using Skia and OMTC with GTK3

Review of attachment 8599938 [details] [diff] [review]:
-----------------------------------------------------------------

There's still some trailing in whitespace

::: gfx/2d/moz.build
@@ +79,4 @@
>          'image_operations.cpp', # Uses _USE_MATH_DEFINES
>      ]
>      EXPORTS.mozilla.gfx += [
> +        'HelpersCairo.h',

These shouldn't be needed anymore.

::: widget/gtk/nsNativeThemeGTK.cpp
@@ +829,5 @@
> +      cairo_surface_t* surf =
> +        cairo_image_surface_create_for_data(map.mData, GfxFormatToCairoFormat(format),
> +                                            aDrawSize.width, aDrawSize.height, map.mStride);
> +      cairo_t* cr = nullptr;
> +      if (!NS_WARN_IF(!surf)) {

This style of NS_WARN_IF is not super common in the code base. It seems reasonble here though.
Attachment #8599938 - Flags: review?(jmuizelaar) → review+
Attached patch fixes for using Skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Remove trailing whitespace
Attachment #8599938 - Attachment is obsolete: true
Attachment #8599981 - Flags: review+
Attached patch fixes for using Skia and OMTC with GTK3 (obsolete) (deleted) — Splinter Review
Refreshed patch to not depend on harfbuzz rename changes
Attachment #8599981 - Attachment is obsolete: true
Attachment #8600209 - Flags: review+
This patch fails to build:

/builds/slave/try-l64-0000000000000000000000/build/src/widget/nsIWidget.h:1659:18: error: 'virtual void nsIWidget::EndRemoteDrawing(mozilla::gfx::DrawTarget*, nsIntRegion&)' was hidden [-Werror=overloaded-virtual]
/builds/slave/try-l64-0000000000000000000000/build/src/widget/nsBaseWidget.h:165:16: error: by 'virtual void nsBaseWidget::EndRemoteDrawing()' [-Werror=overloaded-virtual]
gmake[5]: *** [nsBaseWidget.o] Error 1
gmake[5]: *** Waiting for unfinished jobs....
/builds/slave/try-l64-0000000000000000000000/build/src/widget/nsIWidget.h:1659:18: error: 'virtual void nsIWidget::EndRemoteDrawing(mozilla::gfx::DrawTarget*, nsIntRegion&)' was hidden [-Werror=overloaded-virtual]
/builds/slave/try-l64-0000000000000000000000/build/src/widget/nsBaseWidget.h:165:16: error: by 'virtual void nsBaseWidget::EndRemoteDrawing()' [-Werror=overloaded-virtual]
gmake[5]: *** [Unified_cpp_widget0.o] Error 1
gmake[4]: *** [widget/target] Error 2
(In reply to Mike Hommey [:glandium] from comment #22)
> This patch fails to build:
> 
> /builds/slave/try-l64-0000000000000000000000/build/src/widget/nsIWidget.h:
> 1659:18: error: 'virtual void
> nsIWidget::EndRemoteDrawing(mozilla::gfx::DrawTarget*, nsIntRegion&)' was
> hidden [-Werror=overloaded-virtual]
> /builds/slave/try-l64-0000000000000000000000/build/src/widget/nsBaseWidget.h:
> 165:16: error: by 'virtual void nsBaseWidget::EndRemoteDrawing()'
> [-Werror=overloaded-virtual]
> gmake[5]: *** [nsBaseWidget.o] Error 1
> gmake[5]: *** Waiting for unfinished jobs....
> /builds/slave/try-l64-0000000000000000000000/build/src/widget/nsIWidget.h:
> 1659:18: error: 'virtual void
> nsIWidget::EndRemoteDrawing(mozilla::gfx::DrawTarget*, nsIntRegion&)' was
> hidden [-Werror=overloaded-virtual]
> /builds/slave/try-l64-0000000000000000000000/build/src/widget/nsBaseWidget.h:
> 165:16: error: by 'virtual void nsBaseWidget::EndRemoteDrawing()'
> [-Werror=overloaded-virtual]
> gmake[5]: *** [Unified_cpp_widget0.o] Error 1
> gmake[4]: *** [widget/target] Error 2

Apparently try was using more stringent error warnings than my local mach builds. Working on fixing this.
Fix some try server build issues: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6832f85f55b1
Attachment #8600209 - Attachment is obsolete: true
Attachment #8600419 - Flags: review+
Any chance this can make it before Aurora gets v40 ? Seem to be in 2 days.
Firefox 41 opened for development today so it will not be making 40. I doubt there are any plans to uplift this since the gtk3 builds are tinderbox only.
https://hg.mozilla.org/mozilla-central/rev/8538bc4d2cbd
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Depends on: 1166584
Depends on: 1190935
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: