nsComponentManager ignores CreateInstance critical section. nsComponentManager
should place a monitor before and after the call to a components
CreateInstance() meathod to avoid memory leaks or worse.
An example of this is a singleton component. I may have code like this:
if (mInstance == NULL)
mInstance = new nsProxyEventManager();
If two or more threads are in a step lock state, mInstance will be allocated
more than once.
To avoid this, I would suggest the use of monitors similar to what is done with
Certainly a MP blocker. Will fix it for M6.
The more I think about this, the more I dont want to do this. This would mean
that componentmanager would hold a lock before calling out to create any
instance in the module and release the lock after getting back control. What if
the module turns around and calls cm for other things that would cause the same
component to be created again. That would cause a deadlock.
Any module holding a lock while calling out should be ultra cautious.
I dont see a problem unless in the singleton case. I think I would be
comfortable in saying the singleton should protect against threads just as it
would in any multi threaded environment. Of course, any singleton mechanism we
provide will take care of this.
So I vote to WONTFIX this bug. Opinions. We can discuss this further in
n.p.m.xpcom if you disagree.
Owner/reporter please verify, if applicable.
I am going to reopen. dp. we need to have a thread save version of the
component manager. I believe that there is another bug like this.
Reassigning to new default XPCOM owner, hoping jband will help.
Clearing out of date milestone (was M14) in hope of re-evaluation.
Edward: I'd really love for you to become the XPCOM threading guy. Is that a
I will look into this and see what I can find out. I am not currently savy on
the issues involved, so I will start with learning why it is needed and what the
impact would be from doing this. I do not like needless locks, since it can
kill a program, so I want to know all about the issues before I make any changes
in this area.
reassign all kandrot xpcom bug.
this doesn't happen that often. futuring.
ugh. what I am thinking.
dp was right. the component manager can't hold a lock when calling out to
*** Bug 128646 has been marked as a duplicate of this bug. ***