Closed Bug 1714064 Opened 5 years ago Closed 4 years ago

SPARC: memory allocation of 13908425006175232 bytes failed (passing argument from C++ to Rust issue: https://github.com/rust-lang/rust/issues/86163)

Categories

(Core :: Graphics: WebRender, defect, P3)

Other
Other
defect

Tracking

()

RESOLVED INVALID
Tracking Status
firefox-esr78 --- unaffected
firefox89 --- wontfix
firefox90 --- fix-optional
firefox91 --- fix-optional

People

(Reporter: petr.sumbera, Unassigned)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0

Steps to reproduce:

I see following on SPARC Solaris (x64 Solaris is fine):

firefox -P

(firefox:9800): Gtk-WARNING **: 13:53:55.362: Locale not supported by C library.
        Using the fallback 'C' locale.
[Parent 9800, Main Thread] WARNING: dependent window created without a parent: file /builds/psumbera/mozilla-central-build/toolkit/components/startup/nsAppStartup.cpp:654
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=4.45932) [GFX1-]: glxtest: libpci missing
Crash Annotation GraphicsCriticalError: |[0][GFX1-]: glxtest: libpci missing (t=4.45932) |[1][GFX1-]: No GPUs detected via PCI (t=4.46004) [GFX1-]: No GPUs detected via PCI Fontconfig warning: ignoring C.UTF-8: not a valid language tag
[Socket 9803, Main Thread] WARNING: 'NS_FAILED(rv)', file /builds/psumbera/mozilla-central-build/netwerk/protocol/http/nsHttpHandler.cpp:401
[Socket 9803, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, kKnownEsrVersion) failed with result 0x80004002 (NS_NOINTERFACE): file /builds/psumbera/mozilla-central-build/toolkit/components/resistfingerprinting/nsRFPService.cpp:553
[Parent 9800, Main Thread] WARNING: NS_ENSURE_TRUE(rootFrame) failed: file /builds/psumbera/mozilla-central-build/dom/base/nsGlobalWindowOuter.cpp:4250
[Parent 9800, Main Thread] WARNING: NS_ENSURE_TRUE(root) failed: file /builds/psumbera/mozilla-central-build/layout/base/nsDocumentViewer.cpp:2707
Warning: asking to enable_gpu_markers but no supporting extension was found
memory allocation of 13908425006175232 bytes failed
Redirecting call to abort() to mozalloc_abort


Hit MOZ_CRASH() at /builds/psumbera/mozilla-central-build/memory/mozalloc/mozalloc_abort.cpp:33
#01: mozalloc_abort[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/firefox +0xddda4]
#02: abort[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/firefox +0xdde14]
#03: std::sys::unix::abort_internal::h3b0b7af63279409d[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x2191f1f0]
#04: std::process::abort::h421619498a5204ed[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x218e21c0]
#05: rust_oom[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x218f66a4]
#06: __rg_oom[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x2275a808]
#07: __rust_alloc_error_handler[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x219ad7c0]
#08: alloc::alloc::handle_alloc_error::h2e87f54fa0f4ad5b[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x2197820c]
#09: alloc::raw_vec::RawVec$LT$T$C$A$GT$::allocate_in::hbbe7e551f6ecd946[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1dc19ffc]
#10: alloc::raw_vec::RawVec$LT$T$C$A$GT$::with_capacity_in::he8128b76251bb6b0[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1dc6d50c]
#11: alloc::vec::Vec$LT$T$C$A$GT$::with_capacity_in::h138d9c36ed84ccc1[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1d6c9f48]
#12: alloc::vec::Vec$LT$T$GT$::with_capacity::h09587f9e12b6612a[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1d5b0a3c]
#13: _$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..spec_from_iter_nested..SpecFromIterNested$LT$T$C$I$GT$$GT$::from_iter::h7ae5af012845f18f[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1d5b038c]
#14: _$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..spec_from_iter..SpecFromIter$LT$T$C$I$GT$$GT$::from_iter::h5d754c84cee1e47e[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1d5b4b1c]
#15: _$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$core..iter..traits..collect..FromIterator$LT$T$GT$$GT$::from_iter::h9f45312421b153c9[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1d5b4020]
#16: core::iter::traits::iterator::Iterator::collect::h22d6334fd95a861f[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1d5b592c]
#17: wr_dp_push_stacking_context[/builds/psumbera/mozilla-central-build/INSTALLED/lib/firefox/libxul.so +0x1d59afc8]
[Socket 9803, Main Thread] WARNING: Shutting down Socket process early due to a crash!: file /builds/psumbera/mozilla-central-build/netwerk/ipc/SocketProcessChild.cpp:160
Segmentation Fault (core dumped)

The issue cannot be reproduced when it's run from gdb.
Also gdb doesn't help inspecting core file.

Solaris mdb gives following stack:

    7ce4ef83e6b1 libc.so.1`__lwp_sigqueue+8(b, 0, 0, a, 0, 0)
    7ce4ef83e761 libxul.so`nsProfileLock::FatalSignalHandler+0x224(b, 7ce4ef83f6f0, 7ce4ef83f410, 9, 0, 79a192936480)
    7ce4ef83e841 libxul.so`js::UnixExceptionHandler+0x2c0(b, 7ce4ef83f6f0, 7ce4ef83f410, 0, 0, 79a192936480)
    7ce4ef83e901 libc.so.1`__sighndlr+0xc(b, 7ce4ef83f6f0, 7ce4ef83f410, 79a18b4fb8b0, 0, 79a1abf24000)
    7ce4ef83e9b1 libc.so.1`call_user_handler+0x3f4(19, 7ce4ef83f6f0, 0, 0, b, 0)
    7ce4ef83eaa1 libc.so.1`sigacthandler+0x9c(b, 7ce4ef83f6f0, 7ce4ef83f410, 0, 79a1abf24000, 79a1abf24000)
    7ce4ef83eff1 mozalloc_abort+0xa0(79a1acd706f0, 79a192a00638, 79a1abddacf0, 79a19191f1e8, 0, 79a1acfbbc00)
    7ce4ef83f0a1 abort+0x38(79a1918e21b4, 79a17e0d5310, 79a1918f669c, 79a1918e21b4, 79a1ad047258, 79a1acc44598)
    7ce4ef83f161 libxul.so`std::sys::unix::abort_internal::h3b0b7af63279409d+4(27600000, 79a192a00638, 300000000000000, 79a1918f669c, 79a1ad047258, 79a1acc44598)
    7ce4ef83f211 libxul.so`std::process::abort::h421619498a5204ed+4(1, 79a196aec298, 7ce4ef83fab8, 79a19275a800, 0, 79a1abfd2b66)
    7ce4ef83f2c1 libxul.so`rust_oom+0x48(3169a38be0d400, 8, 79a1918f65e8, 79a1918f65e8, 9ffd0, 79a1acc44598)
    7ce4ef83f371 libxul.so`__rg_oom+8(3169a38be0d400, 8, 79a18dc19ff4, 79a191978204, 79a1ad047258, 79a1acc44598)
    7ce4ef83f421 libxul.so`__rust_alloc_error_handler+8(3169a38be0d400, 8, 8, 79a18dc19ff4, 0, 79a1acc44598)
    7ce4ef83f4d1 libxul.so`alloc::alloc::handle_alloc_error::h2e87f54fa0f4ad5b+8(3169a38be0d400, 8, 8, 79a18dc6d504, 79a1ad047258, 79a1acc44598)
    7ce4ef83f581 libxul.so`alloc::raw_vec::RawVec$LT$T$C$A$GT$::allocate_in::hbbe7e551f6ecd946+0x194(0, 1, 0, 79a18d6c9f40, 79a1ad047258, 79a1acc44598)
    7ce4ef83f731 libxul.so`alloc::raw_vec::RawVec$LT$T$C$A$GT$::with_capacity_in::he8128b76251bb6b0+0x14(79a192936480, 0, 79a18d5b0384, 79a18d5b0a34, 79a1ad047258,
79a1acc44598)
    7ce4ef83f811 libxul.so`alloc::vec::Vec$LT$T$C$A$GT$::with_capacity_in::h138d9c36ed84ccc1+0xc(7ce4ef8408f0, 79a192936480, 79a192936480, 79a18d5b0384, 79a1ad047258,
79a1acc44598)
    7ce4ef83f8f1 libxul.so`alloc::vec::Vec$LT$T$GT$::with_capacity::h09587f9e12b6612a+0xc(7ce4ef8408f0, 79a192936480, 79a18d5b4018, 79a18d5b4b14, 79a1ad047258, 79a1acc44598)
    7ce4ef83f9b1 libxul.so`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..spec_from_iter_nested..SpecFromIterNested$LT$T$C$I$GT$$GT$::from_iter::h7ae5af012845f18f+0x60(79a192936480, 1, 12d9c96f745b000, 79a18d5b4018, 79a1ad047258, 79a1acc44598)
    7ce4ef83fab1 libxul.so`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..spec_from_iter..SpecFromIter$LT$T$C$I$GT$$GT$::from_iter::h5d754c84cee1e47e+0x14(
7ce4ef8408f0, 100000000000000, 12d9c96f745b000, 79a18d5b5924, 79a1ad047258, 79a1acc44598)
    7ce4ef83fb71 libxul.so`_$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$core..iter..traits..collect..FromIterator$LT$T$GT$$GT$::from_iter::h9f45312421b153c9+0x30(7ce4ef8408f0,
100000000000000, 12d9c96f745b000, 79a18d59afc0, 79a1ad047258, 11)
    7ce4ef83fc51 libxul.so`core::iter::traits::iterator::Iterator::collect::h22d6334fd95a861f+0x14(7ce4ef8408f0, 100000000000000, 12d9c96f745b000, 4, 0, 79a192936480)
    7ce4ef83fd11 libxul.so`wr_dp_push_stacking_context+0x1dc(100000000000000, 79a192936480, 8ef840a31, 0, 79a17e80e478, 8ef840a31)
    7ce4ef840911 libxul.so`mozilla::wr::DisplayListBuilder::PushStackingContext+0x210(79a17e80e478, 0, 79a17e80e478, 7ce4ef841588, 79a167b1df30, 79a192936480)
    7ce4ef840ac1 libxul.so`mozilla::layers::StackingContextHelper::StackingContextHelper+0x8b0(7ce4ef841748, 7ce4ef841670, 0, 0, 7ce4ef841698, 7ce4ef841a90)
    7ce4ef840c51 libxul.so`mozilla::layers::WebRenderCommandBuilder::BuildWebRenderCommands+0x304(79a167b7ba50, 7ce4ef841a90, 7ce4ef841a28, 79a1677d7fb0, 79a1677d6000,
79a167b7b910)
    7ce4ef8410c1 libxul.so`mozilla::layers::WebRenderLayerManager::EndTransactionWithoutLayer+0x39c(79a167b7b800, 79a1677d7fb0, 79a1677d6000, 79a167b7b910, 79a167b7ba50,
79a192936480)
    7ce4ef841601 libxul.so`nsDisplayList::PaintRoot+0x540(7ce4ef842238, 79a1677d7fb0, 79a1677d6000, 0, d, 79a192936480)
    7ce4ef8417f1 libxul.so`nsLayoutUtils::PaintFrame+0x32d0(0, 79a167b86020, 7ce4ef844728, fff4f5f6, 7ce4ef844440, 7ce4ef844440)
    7ce4ef843c41 libxul.so`mozilla::PresShell::Paint+0xf54(79a19a2d2000, 79a167b25880, 7ce4ef844728, 1, 0, 79a192936480)
    7ce4ef843e51 libxul.so`nsViewManager::ProcessPendingUpdatesPaint+0x438(79a167b1a200, 79a197a3b000, 1, 3e5, 79a19a2d2000, 79a192936480)
    7ce4ef843f51 libxul.so`nsViewManager::ProcessPendingUpdatesForView+0x3bc(79a167b1a200, 79a167b25880, 1, 79a1abf24000, 0, 79a192936480)
    7ce4ef844081 libxul.so`nsViewManager::ProcessPendingUpdates+0x12c(79a167b1a200, 79a167b1a200, 0, 0, 79a192936480, 79a192936480)
    7ce4ef844161 libxul.so`nsRefreshDriver::Tick+0x1f84(79a167b2d800, 93, ce184b4dee1d0, 40, 4, 79a192936480)
    7ce4ef844631 libxul.so`mozilla::RefreshDriverTimer::TickDriver+0x24(79a167b2d800, 93, ce184b4dee1d0, 3752bb, ce18484c58e00, 79a192936480)
firefox:core>

I was able to track down this to first bad commit:

Bug 1701231 - Allow Software WebRender on non-x86 targets. r=jrmuizel

The problem can be avoided by reverting changes for Bug 1701231. For latest Firefox sources it's following patch:

diff -r 1514fcbf80a0 -r d8240e9db9fa widget/gtk/GfxInfo.cpp
--- a/widget/gtk/GfxInfo.cpp    Sun May 30 16:04:16 2021 +0000
+++ b/widget/gtk/GfxInfo.cpp    Wed Jun 02 09:51:19 2021 +0200
@@ -749,11 +749,13 @@

     ////////////////////////////////////
     // FEATURE_WEBRENDER_SOFTWARE - ALLOWLIST
+#if 0
     APPEND_TO_DRIVER_BLOCKLIST(OperatingSystem::Linux, DeviceFamily::All,
                                nsIGfxInfo::FEATURE_WEBRENDER_SOFTWARE,
                                nsIGfxInfo::FEATURE_ALLOW_ALWAYS,
                                DRIVER_COMPARISON_IGNORED, V(0, 0, 0, 0),
                                "FEATURE_ROLLOUT_SOFTWARE_WR", "");
+#endif

     ////////////////////////////////////
     // FEATURE_WEBRENDER_COMPOSITOR
Keywords: regression
Regressed by: 1701231
Has Regression Range: --- → yes

Any idea what can be possibly wrong? I have no insight to this. Note that SPARC is big endian platform.

Flags: needinfo?(aosmond)

Set release status flags based on info from the regressing bug 1701231

You can also just flip the pref gfx.webrender.force-disabled to true in your prefs file to avoid recompiling. While I expect this pref to go away this year, it won't be before the next ESR ships.

OS: Unspecified → Linux
Hardware: Unspecified → Other
Component: Untriaged → Graphics: WebRender
Product: Firefox → Core

Perhaps you can put some logging in wr_dp_push_stacking_context to figure out which call to collect() is causing the problem.

Flags: needinfo?(aosmond)
OS: Linux → Other

Both collects are on memory backed by an nsTArray, which you'd think would be fairly safe. I'm curious to know if their state is sane before going into Rust -- some logging dumping aParams.mFilters and aParams.mFilterDatas might be useful too:

https://searchfox.org/mozilla-central/rev/74f3c420ee54001059e1850bef3be876749ff873/gfx/webrender_bindings/WebRenderAPI.cpp#1028

(In reply to Jeff Muizelaar [:jrmuizel] from comment #4)

Perhaps you can put some logging in wr_dp_push_stacking_context to figure out which call to collect() is causing the problem.

It's last collect() here:
https://searchfox.org/mozilla-central/rev/85a74c965bd4bcab091b5767c13c44f84671d9ce/gfx/webrender_bindings/src/bindings.rs#2476

What's the value of filter_datas_count?

Flags: needinfo?(petr.sumbera)

(In reply to Andrew Osmond [:aosmond] from comment #5)

Both collects are on memory backed by an nsTArray, which you'd think would be fairly safe. I'm curious to know if their state is sane before going into Rust -- some logging dumping aParams.mFilters and aParams.mFilterDatas might be useful too:

https://searchfox.org/mozilla-central/rev/74f3c420ee54001059e1850bef3be876749ff873/gfx/webrender_bindings/WebRenderAPI.cpp#1028

I have just tried aParams.mFilters.Length() and aParams.mFilterDatas.Length():

--- a/gfx/webrender_bindings/WebRenderAPI.cpp   Wed Jun 02 09:51:19 2021 +0200
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp   Thu Jun 03 16:01:42 2021 +0200
@@ -1024,7 +1024,7 @@
   WRDL_LOG("PushStackingContext b=%s t=%s\n", mWrState,
            ToString(aBounds).c_str(),
            transform ? ToString(*transform).c_str() : "none");
-
+printf("XXX DisplayListBuilder::PushStackingContext a %ld %ld\n", aParams.mFilters.Length(), aParams.mFilterDatas.Length());
   auto spatialId = wr_dp_push_stacking_context(
       mWrState, aBounds, mCurrentSpaceAndClipChain.space, &aParams,
       maybeTransform, aParams.mFilters.Elements(), aParams.mFilters.Length(),

and it says:

XXX DisplayListBuilder::PushStackingContext a 0 0

Flags: needinfo?(petr.sumbera)

(In reply to Jeff Muizelaar [:jrmuizel] from comment #7)

What's the value of filter_datas_count?

println!("XXX wr_dp_push_stacking_context start {}", filter_datas_count);

says:

133081200598864

Well it doesn't look right :-)

When I print out filter_count it's 0 as expected... Maybe some rust SPARC ABI issue?!

Yeah, that seems possible. We've definitely run into Rust compiler ABI bugs on other platforms with the WebRender API in the past.
You'll probably have to look through the generated asm to see what's going on.

Flags: needinfo?(petr.sumbera)
Severity: -- → S3
Priority: -- → P3

I have filed Rust bug here: https://github.com/rust-lang/rust/issues/86163 . Any suggestion welcome.

Flags: needinfo?(petr.sumbera)
Depends on: 1715895
Summary: memory allocation of 13908425006175232 bytes failed → SPARC: memory allocation of 13908425006175232 bytes failed (passing argument from C++ to Rust issue: https://github.com/rust-lang/rust/issues/86163)

The issue was resolved in Rust. Closing the bug.

Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.