Closed Bug 522332 Opened 15 years ago Closed 14 years ago

nsProfileLock::FatalSignalHandler is not async-signal-safe

Categories

(Toolkit :: Startup and Profile System, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: karlt, Assigned: justin.lebar+bug)

References

Details

Attachments

(1 file, 1 obsolete file)

nsProfileLock::FatalSignalHandler()
 -> RemovePidLockFiles()
   -> lock->Unlock()
     -> free()

Perhaps either nsProfileLock could use a free-list instead of free, or perhaps special Unlock()ing is needed for signal handling.

(There also seems to be an assumption here that the handler will only be called on one thread.)
Blocks: 566208
Since it's a fatal signal, do we need to bother calling free()?
Attached patch Patch v1 (obsolete) — Splinter Review
Jesse, could you see if this patch fixes the hang you reported in bug 566208?
Attachment #457722 - Flags: feedback?
Attachment #457722 - Flags: feedback? → feedback?(jruderman)
Comment on attachment 457722 [details] [diff] [review]
Patch v1

I can't reproduce my bug at will.  I tried various combinations of long and short timeouts, builds with and without breakpad.  Sorry I can't usefully test this patch.
Attachment #457722 - Flags: feedback?(jruderman)
Is it only in the killed-by-abort case that we skip the "free"?  Or does this introduce a leak into normal shutdown that I'll need to tell Valgrind to ignore?
Rather than "See bug 522332", I think the comment should explain exactly why it's not safe to call free() in this case, and what the implications of not calling free() are.
Attached patch Patch v2Splinter Review
This one should only leak on a fatal signal.  I dunno if that's worth informing Valgrind of.
Assignee: nobody → justin.lebar+bug
Attachment #457722 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #460279 - Flags: review?(benjamin)
Thanks.

We're going to "leak" almost everything when we get a fatal signal, so "leaking" one additional thing is fine.
+            if (!aFatalSignal)
+              free(mPidLockFileName);

free is under-indented
(In reply to comment #8)
> free is under-indented

Fixed locally.  Thanks.
Nominating as blocking 2.0 since this harms user experience when FF crashes -- it's much better for it to cleanly die than to hang.
blocking2.0: --- → ?
On the fence really but I guess being able to kill Firefox cleanly is important.
blocking2.0: ? → final+
Attachment #460279 - Flags: review?(benjamin) → review+
http://hg.mozilla.org/mozilla-central/rev/52172131101f
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: