Do pthread_atfork in jemalloc on mac and android

RESOLVED FIXED in mozilla14

Status

()

Core
mozglue
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: glandium, Assigned: glandium)

Tracking

Trunk
mozilla14
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Currently, the pthread_atfork call from jemalloc is only done on Linux. There used to be a workaround in the ipc code, around a fork, but it went away recently. Anyways, to avoid any future surprise around this, we'd be better off doing pthread_atfork on Android, which "only" requires a few wrapped functions.
And we should also do it on mac, since that's supported.
Assignee: nobody → mh+mozilla
Created attachment 607211 [details] [diff] [review]
Do pthread_atfork in jemalloc on mac and android
Attachment #607211 - Flags: review?(khuey)
Attachment #607211 - Flags: review?(blassey.bugs)
Attachment #607211 - Flags: feedback?(justin.lebar+bug)
I don't pretend to know exactly what's going on here, but 

         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
+        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork"

the second line doesn't overwrite the first one here?
Attachment #607211 - Flags: feedback?(justin.lebar+bug) → feedback+
(In reply to Justin Lebar [:jlebar] from comment #2)
> I don't pretend to know exactly what's going on here, but 
> 
>          WRAP_LDFLAGS="${WRAP_LDFLAGS}
> -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
> +        WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork"
> 
> the second line doesn't overwrite the first one here?

It's appends each time.
> It's appends each time.

Wow, it's like they *tried* to make a ridiculous language.
(In reply to Mike Hommey [:glandium] from comment #0)
> Currently, the pthread_atfork call from jemalloc is only done on Linux.
> There used to be a workaround in the ipc code, around a fork, but it went
> away recently. 
What went away?
(In reply to Brad Lassey [:blassey] from comment #5)
> (In reply to Mike Hommey [:glandium] from comment #0)
> > Currently, the pthread_atfork call from jemalloc is only done on Linux.
> > There used to be a workaround in the ipc code, around a fork, but it went
> > away recently. 
> What went away?

See bug 622992. While this avoids the problem that using the atfork callbacks solves, it doesn't ensure that future changes won't break assumptions again. Or that we won't be doing a fork() for some place else.
Attachment #607211 - Flags: review?(blassey.bugs) → review+
Attachment #607211 - Flags: review?(khuey) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/c6634316f474
https://hg.mozilla.org/mozilla-central/rev/c6634316f474
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla14
This breaks b2g build.
(In reply to Kan-Ru Chen [:kanru] from comment #9)
> This breaks b2g build.

Please file a bug. Do i guess right that it fails to link libmozglue because it can't find pthread_atfork?
Depends on: 738559

Updated

5 years ago
Depends on: 738561

Updated

5 years ago
Depends on: 738709
You need to log in before you can comment on or make changes to this bug.