c-deps: bump jemalloc to pick up Darwin deadlock fix#35789
c-deps: bump jemalloc to pick up Darwin deadlock fix#35789craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
|
Depends on cockroachdb/jemalloc#1. Note that cockroachdb/jemalloc#1 only changes code that is used on Darwin, so this is relatively safe (unless we suspect Darwin builds are being used in production somewhere). The only concern would be if this disrupts development on Mac's somehow. |
|
The alternative to this change would be to disable jemalloc on Darwin. |
|
LGTM. Thanks for figuring this out. |
|
@bdarnell Let me know your thoughts on this. |
bdarnell
left a comment
There was a problem hiding this comment.
LGTM. I'm surprised this makes a difference because we don't use fork() (and IIRC go is generally not compatible with fork-without-exec), but if we've empirically verified that it fixes the problem I'm happier backporting this than upgrading jemalloc at this stage.
We |
|
Note that with go1.11 system calls on Darwin didn't use I wonder if that makes a difference. |
Under go1.12, `cockroach` can deadlock deep within jemalloc. An upstream change in jemalloc fixed this in the 5.1.0 release, but we're hesitant to bump the jemalloc version as the last time we tried we ran into slow memory leaks. It is unclear why this deadlock started to appear in go1.12 but does not manifest with earlier versions of go. Perhaps the switch to perform system calls via `libSystem` is to blame. Perhaps there was a change to how fork is handled in go1.12. Fixes cockroachdb#35620 Release note: None
d67feb4 to
e252684
Compare
|
Oh, I think I get it now. I thought fork+exec was safe because no memory is allocated in the child process before the exec system call. But thanks to a post-fork hook used here, there is activity in the malloc system even if the code between fork+exec is restricted to non-allocating signal-safe functions. I also forgot about how some of our metric-collection libraries work by shelling out to subprocesses on macos, so we do fork+exec all the time even without --background. |
|
bors r=tbg,bdarnell |
35789: c-deps: bump jemalloc to pick up Darwin deadlock fix r=tbg,bdarnell a=petermattis Under go1.12, `cockroach` can deadlock deep within jemalloc. An upstream change in jemalloc fixed this in the 5.1.0 release, but we're hesitant to bump the jemalloc version as the last time we tried we ran into slow memory leaks. It is unclear why this deadlock started to appear in go1.12 but does not manifest with earlier versions of go. Perhaps the switch to perform system calls via `libSystem` is to blame. Perhaps there was a change to how fork is handled in go1.12. Fixes #35620 Release note: None Co-authored-by: Peter Mattis <petermattis@gmail.com>
Build succeeded |
|
Should this be backported to 2.1, or are we close enough to the 19.1 release to not bother? |
|
I think this should be backported (and also the PRs linked in #35197). The next release from the 2.1 branch may not come until after 19.1.0 (so they'll never go into homebrew), but there will still be more 2.1 releases and we'll want them to be able to build with newer versions of go (we've done this for past releases) |
Under go1.12,
cockroachcan deadlock deep within jemalloc. An upstreamchange in jemalloc fixed this in the 5.1.0 release, but we're hesitant
to bump the jemalloc version as the last time we tried we ran into slow
memory leaks. It is unclear why this deadlock started to appear in
go1.12 but does not manifest with earlier versions of go. Perhaps the
switch to perform system calls via
libSystemis to blame. Perhapsthere was a change to how fork is handled in go1.12.
Fixes #35620
Release note: None