OS X Startup crash Hit MOZ_CRASH(CLOCK_MONOTONIC is absent!) at gecko-dev/mozglue/misc/TimeStamp_posix.cpp:181 after Xcode 8 Update

RESOLVED FIXED in Firefox 52

Status

()

Core
Build Config
P1
critical
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: mchang, Assigned: mchang)

Tracking

({crash})

51 Branch
mozilla52
x86
Mac OS X
crash
Points:
---

Firefox Tracking Flags

(firefox51 fix-optional, firefox52 fixed)

Details

Attachments

(3 attachments)

(Assignee)

Description

a year ago
Xcode decided to update itself today

clang --version
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

After building Firefox today, I'm getting a start up crash. This only seems to happen with Xcode 8 and El Capitan. The Xcode 8 update and the macOS Sierra GM I'm running on another machine don't have this problem.
(Assignee)

Comment 1

a year ago
Created attachment 8791815 [details] [diff] [review]
Temp Fix

It looks like CONFIG['HAVE_CLOCK_MONOTONIC'] is true now for some reason, still trying to find out where this is defined, but this is a temporary fix.
(Assignee)

Updated

a year ago
Component: Widget: Cocoa → Build Config
(Assignee)

Comment 2

a year ago
Created attachment 8792081 [details] [diff] [review]
Do a runtime check for clock_Gettime

Not sure you're the right person, but it looks like in Xcode 8, clock_gettime was added to the SDK. The current configure just tries to link it, but not run it. However, at runtime, clock_gettime fails with "No file or directory found". Doing a test clock_gettime outside of gecko, I get a correct link and compile but a runtime error of:

"dyld: lazy symbol binding failed: Symbol not found: _clock_gettime
  Referenced from: /Users/masonchang/Projects/temp/./a.out (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib
"

On macOS sierra, everything works as expected and clock_gettime is implemented, but not on El Capitan. I suspect before Xcode 8, clock_gettime didn't even link.

This patch changes the check in our configure script to do a runtime check.

Just an FYI, I'm going on PTO for two weeks, so if this is properly reviewed, someone else can please try to land this. Thanks!
Attachment #8792081 - Flags: review?(mh+mozilla)
Assignee: nobody → mchang
Status: NEW → ASSIGNED
Severity: normal → critical
Keywords: crash
Priority: -- → P1
Comment on attachment 8792081 [details] [diff] [review]
Do a runtime check for clock_Gettime

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

::: js/src/old-configure.in
@@ +1223,4 @@
>                 [for libs in "" -lrt; do
>                      _SAVE_LIBS="$LIBS"
>                      LIBS="$LIBS $libs"
> +                    AC_TRY_RUN([

AC_TRY_RUN needs to be avoided at all costs. It breaks cross-compilations (think Android).
Considering we're targeting versions of OSX that don't have the function, at least for now, we can simplify the problem and just not check for clock_gettime on that platform (assuming the test does return no currently)
Attachment #8792081 - Flags: review?(mh+mozilla) → review-
(In reply to Mike Hommey [:glandium] from comment #3)
> AC_TRY_RUN needs to be avoided at all costs. It breaks cross-compilations
> (think Android).
> Considering we're targeting versions of OSX that don't have the function, at
> least for now, we can simplify the problem and just not check for
> clock_gettime on that platform (assuming the test does return no currently)

Or we can branch out the AC_TRY_RUN using $OS_TARGET = Darwin and therewith save cross-compilation, or dumb idea?
(In reply to Mike Hommey [:glandium] from comment #3)
> AC_TRY_RUN needs to be avoided at all costs. It breaks cross-compilations
> (think Android).

I happened to do an all-platform push with this patch in the queue, and I can confirm that it breaks compilation for Android. :)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=1c6e526473c2
Created attachment 8793835 [details] [diff] [review]
Don't check for CLOCK_MONOTONIC on darwin
Attachment #8793835 - Flags: review?(mh+mozilla)
The patch above is building just fine on 10.12 for me, and here's a try run to make sure it doesn't mess things up on our builders https://treeherder.mozilla.org/#/jobs?repo=try&revision=02c5273d0ae3
Attachment #8793835 - Flags: review?(mh+mozilla) → review+

Comment 8

a year ago
Pushed by hurley@todesschaf.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/e568feccbb14
Don't check for CLOCK_MONOTONIC on darwin r=glandium
Duplicate of this bug: 1304305

Updated

a year ago
Duplicate of this bug: 1305738

Comment 11

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/e568feccbb14
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
status-firefox52: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Thanks so much, Mason, Nicholas and Mike!
Mark 51 as fix-optional. If it's worth uplifting to 51, feel free to nominate it.
status-firefox51: affected → fix-optional
Well, it might be worth uplifting, but it also won't help much: currently my local Fx 51 build (tried both debug and opt) segfaults at startup. Even though it's wonderful to be able to build it, running is kind of another requirement.
You need to log in before you can comment on or make changes to this bug.