Nearly finished Events get processed again while shutdown.

RESOLVED INVALID

Status

()

Core
XPCOM
RESOLVED INVALID
10 years ago
10 years ago

People

(Reporter: Christian Haider, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
Created attachment 324762 [details]
An Extension which test the case

It seams that an event gets processed again if it isn't completed before shutdown.

The following testcase does the following
1. create a nsIThread and dispatches a nsIRunnable (nsThreadTestSender.h/cpp)
2. In the run() it waits 10 seconds then creates an object of nsITheadTestObject which is a nsIRunnable as well
3. It saves the currentThread into the nsIThreadTestObject and dispatches the nsITheadTestObject to the mainthread.
4. In its run() the nsITheadTestObject calles ThreadFinished() a function of nsIThreadTest which is a self written service.
5. ThreadFinished() uses PR_Lock(lock) before shutdown the the thread in the nsITheadTestObject
6. after the shutdown it should PR_Unlock(lock)


Somewhere between 5 and 6 during the shutdown all pending events of the thread are getting processed. But there is only one event which isn't fully processed and this one gets started from the beginning. 

The result is, that it restarts at step 3 with the result that step 5 it will PR_Lock(lock) again which is not supported because lock are not reentrent.

Updated

10 years ago
Component: Event Handling → XPCOM
QA Contact: events → xpcom
You are creating 100 new threads, which means 100 attempts to call ThreadFinished. While the first is waiting in nsIThread::Shutdown the next one comes along and so fails.
Status: NEW → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.