Hi,

I'm working on OpenOffice writing an SDBC driver to access the Mozilla addressbooks
via the Mozilla nsIAb* interfaces, ie. I'm using Mozilla's components withing
OpenOffice. 

I'm performing initialization of Mozilla pretty much the same way NS_InitEmbedding()
works (except for the initialization of the chrome registry as we don't use XUL in
anyway in our code and no auto-registration, we want to control this), ie:

-       Init XPCOM
-       Create an EventQ
-       Create a StartupNotifier nsIObserver and call Observe
-       Create an nsIStringBundleService

The problem I'm having is in relation to the use of the nsIAbLDAPDirectoryQuery
interfaces in Mozilla 0.9.5. Everything used to work perfectly until the
introduction of a ProxyObject to handle an nsDNSListener object in nsLDAPConnection.
(Believe me I've debugged this enough to know that this is where things are
going wrong)... 

What appears to be happening is that a ProxyObject is created (using the 
PROXT_SYNC and PROXY_ALWAYS flags) and this is passed successfully into the
nsDnsService and nsDnsLookup interfaces... Later when a DNS lookup has 
been successfully done, an attempt is made in the nsDnsLookup::FireStop()
method to call the OnFound method of the nsDNSListener via the ProxyObject.
Debugging into the ProxyObject, there are two seperate threads in use
so it doesn't call the nsDNSListener::OnFound() method directly, it
successfully calls PostAndWait, which in turn calls Post() successfully
and then waits... (it also has to create an eventQ for the thread it's 
running in because there isn't one already present).

It's seems that (since there's no timeout on this) the wait then continues
indefinately, never returning. If I examine all threads I notice two calls
to PR_WaitCondVar (or something like that), one in the ProxyObject code
and another in what seems to be the eventQ that's created during 
initialization. It seems like deadlock, but I'm not 100% sure of this, all
I know for definate is that the nsDNSListener::OnFound() method is never
actually called, and so it never returns.

There are a couple of points that might be of interest:

1) We're not using a full set of components (though using the full set still
   exhibits the same behaviour)

2) We're not calling NS_InitEmbedding() but even if we do, things still
   work the same.

3) This problem has not been reproduced in Mozilla yet, I can only see
   it in the enviroment I'm using (ie. OpenOffice + Mozilla "embedded")
   but that doesn't mean it's not there... 

4) There may still be some outstanding initialization that occurs in
   Mozilla itself, which I'm not doing, but I've no idea what...

5) I've reproduced this problem exactly the same way on Win2K and Linux.

If anyone could please help or at least shed some light on what might be 
causing the failure to call the OnFound method, it'd be much appreciated,

Many Thanks,

Darren.
begin:vcard 
n:Kenny;Darren
tel;fax:+353 1 8199078
tel;work:+353 1 8199115
x-mozilla-html:FALSE
org:<A HREF="http://www.sun.com/";>Sun Microsystems</A>;Desktop Applications and Middleware
adr:;;;Dublin;;;Ireland
version:2.1
email;internet:[EMAIL PROTECTED]
title:Software Engineer
x-mozilla-cpt:;23672
fn:Darren Kenny
end:vcard

Reply via email to