Closed Bug 1403074 Opened 7 years ago Closed 7 years ago

stylo: crashed [@ core::sync::atomic::atomic_add<usize>] on Android/arm debug build

Categories

(Core :: CSS Parsing and Computation, defect, P4)

Unspecified
Android
defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox57 --- wontfix
firefox58 --- fix-optional

People

(Reporter: m_kato, Unassigned)

References

Details

Crash log is here.

https://treeherder.mozilla.org/logviewer.html#?job_id=132923044&repo=try&lineNumber=1808

This might be rust compiler bug.  nsStyleContext has 3 values (mPseudoTag, mBits and mFrameRefCnt) on debug build, and mBits (2nd value) is uint64_t.  So on arm, offset of it may be 8 bytes, not 4 bytes.  But rust compiler uses that offset is 4 bytes.  So this crash occurs.

We need consider alignment of nsStyleContext.
I have no idea why nsStyleContext is involved on stylo. CCing people who had investigated about stylo for linux 32bit (IIRC).
Summary: Stylo: crashed [@ core::sync::atomic::atomic_add<usize>] on Android/arm debug build → stylo: crashed [@ core::sync::atomic::atomic_add<usize>] on Android/arm debug build
Simple workaround is that we change order of each value (1st is mBits, 2nd is mPseudoTag)
(In reply to Hiroyuki Ikezoe (:hiro) PTO on 28 Sep. from comment #1)
> I have no idea why nsStyleContext is involved on stylo.

IIUC, ComputedValues in Rust side is ServoStyleContext in C++ side (somehow), and ServoStyleContext inherits nsStyleContext.
(In reply to Xidorn Quan [:xidorn] UTC+10 from comment #3)
> (In reply to Hiroyuki Ikezoe (:hiro) PTO on 28 Sep. from comment #1)
> > I have no idea why nsStyleContext is involved on stylo.
> 
> IIUC, ComputedValues in Rust side is ServoStyleContext in C++ side
> (somehow), and ServoStyleContext inherits nsStyleContext.

Yeah, Cameron told me that on IRC. I had totally forgotten about the great work done by Manish.
And... I don't think Rust should be aligning u64 to 4 bytes, given that Rust has a test since long ago checking that u64 is aligned to 8 bytes on android arm: https://github.com/rust-lang/rust/blob/master/src/test/run-pass/rec-align-u64.rs
Oh, well, but Rust doesn't run tests on Android... so maybe that just fails silently :/
(Marking as not blocking 57)

Thanks for chasing this down Makoto!
Priority: -- → P4
Yeah this is likely a bindgen bug on ARM (or a mistake in the manual alignment guesses made there, though that should show up in the ServoStyleContext fields, not the shared nsStyleContext ones. What we have works on the platforms we've run layout tests on, but may be broken on android)
I don't think that's a bindgen bug. The code bindgen generates seems reasonable.
FWIW, you can always download the target.stylo-bindings.zip file for any stylo build on treeherder to inspect the code bindgen generates. For this case, it should be in https://treeherder.mozilla.org/#/jobs?repo=try&revision=6d5b01ce823c5515bd45050176e1ec2bdf6dbbb5&selectedJob=132922134
Does this still persist?  I can't see the crash on local build.  Also the failure log in comment 0 is no longer visible so I have no idea what's going on there and what solved this crash.
Makoto-san ^
Flags: needinfo?(m_kato)
This is fixed by another manish's landing (https://github.com/servo/servo/pull/18667).  Maybe, root cause isn't fixed, but I cannot reproduce this by simple rust code yet.  So this isn't blocker of stylo now.
Flags: needinfo?(m_kato)
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.