Closed Bug 498166 Opened 15 years ago Closed 9 years ago

malloc_init deadlock due to pthread_atfork

Categories

(Core :: Memory Allocator, defect)

x86
Linux
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox41 --- fixed

People

(Reporter: daniel-gl, Assigned: leila.hadji)

References

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.8.1.19) Gecko/20081204 SeaMonkey/1.1.14 Build Identifier: http://download.mozilla.org/?product=firefox-3.5b4&os=linux&lang=de malloc_init_hard calls pthread_atfork which in turn may call malloc => deadlock Both the nptl and the linuxthreads implementation of pthread_atfork allocate memory on the fly. On nptl we don't observe this bug because pthread_atfork has an initial pool and allocation happens in chunks of 48 entries. On linuxthreads malloc is called everytime. Reproducible: Always Steps to Reproduce: 1. run a linux system with linuxthreads instead of nptl 2. start firefox Actual Results: - system becomes idle - no window, no message in terminal - process sleeps in pthread_mutex_lock(&init_lock) Expected Results: - a browser window opens Moving the call to pthread_atfork between malloc_initialized = true; and malloc_mutex_unlock(&init_lock); should fix the bug.
We have encountered this problem too, when bringing-up FxOS on a device. The suggested approach from Daniel fixes the problem (attached patch).
Attachment #8609331 - Flags: review?(mh+mozilla)
Attachment #8609331 - Flags: review?(mh+mozilla) → review+
Keywords: checkin-needed
Assignee: nobody → leila.hadji
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: