Open Bug 661995 Opened 14 years ago Updated 1 month ago

nsIThreadInternal::OnProcessNextEvent inaccurate recrsionDepth parameter

Categories

(Core :: XPCOM, defect)

x86_64
Linux
defect

Tracking

()

People

(Reporter: mcmanus, Unassigned)

References

Details

The main event loop in the socket thread uses code that tests recursionDepth to prevent DoPollIteration() from being called recursively out of OnProcessNextEvent().

http://mxr.mozilla.org/mozilla2.0/source/netwerk/base/src/nsSocketTransportService2.cpp#541

Unfortunately, it doesn't seem to work in that combination - leading to stack traces like the one seen here: https://bugzilla.mozilla.org/show_bug.cgi?id=654201#c8 

In that trace you'll see DoPollIteration on the stack 2 times, and OnProcessNextEvent there three times. (The code intends to allow the latter to be there twice and the former to be there just once).

This issue can be worked around in the socket thread by just keeping a local semaphore instead of relying on recursionDepth.

ben turner helped me figure it out and said 

> Also, I think this goes to show how fragile it is to run events from
> the OnProcessNextEvent callback. It's really not designed for this.
Blocks: 654201
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.