Re: RPC_E_WRONG_THREAD on accessing interface pointer from GIT
The thread that gets the interface (allow me to call it
IObjectInterface) pointer from the GIT, is managed by COM+. In fact the
IObjectInterface pointer is retrieved from the GIT from another COM
object, i.e. just another instance of the same component.
The component is registered with COM+. The objects run in a COM+ host
process, i.e. they are part of a COM+ server type application. The
threading model for the component is set to "Any Apartment", i.e. this
is what the properties concurrency tab for this component displays (in
management console component services).
The component itself is implemented as multithreaded. But I don't know
what kind of apartment COM+ uses for the object. Neither do I know if
the concurrency model for the thread that COM+ uses is set to apartment
threaded or multithreaded.
I would assume that COM+ assigns the objects to the multithreaded
apartment. I guess using the GIT in this specific case, where one
object needs an interface pointer to another object in the same
apartment, is not necessary. But then again, I do not know how COM+
manages things internally. Furthermore, I think using the GIT offers an
easy way to pass interface pointers without worrying about which
apartment an object is living in. I would rather stick to using the
GIT.
I don't think my code contains an obvious COM inconsistency, because I
only had this error once, during a load test, i.e. 999 times it went
well, 1 time bad. The one time it went bad, the one object did
successfully retrieve the pointer to the other object from the GIT, but
it couldn't query for an interface on it, and my guess is, the release
on it failed as well, because at the end of my testrun, one object was
not released. When I checked my logfiles, it turned out it was the
object for which an interface pointer could not be retrieved through
QueryInterface (it failed with RPC_E_WRONG_THREAD).
Kind regards,
Frederiek
mysteron wrote:
> what apartment type does your thread belong to?
>
> "Frederiek" <fd_news@xxxxxxxxxxx> wrote in message
> news:1138797822.968466.86010@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> > Hi,
> >
> > How can calling a method on an interface pointer that was retrieved
> > from the global interface table, result in an RPC_E_WRONG_THREAD return
> > value? I thought the whole point of the GIT was to avoid this kind of
> > problems?
> >
> > An interface pointer was succesfully retrieved from the GIT, but
> > calling QueryInterface on the retrieved pointer (about 16ms later)
> > failed with RPC_E_WRONG_THREAD.
> >
> > The pointer was succesfully removed from the GIT some time after the
> > failure occurred.
> >
> > Did anyone else ever run into this problem? Is there an explanation, or
> > better, a solution for this phenomenon?
> >
> > Kind regards,
> >
> > Frederiek
> >
.
Relevant Pages
- Re: Access violation error using smart pointer stored in GIT
... You don't store smart pointers in GIT (you can't as it's a COM ... interface so you can only pass COM types, ... a smart pointer again, see Kim's post. ... (microsoft.public.vc.atl) - Access violation error using smart pointer stored in GIT
... pointer stored in GIT. ... registers a pointer in Global Interface Table in the constructor as ... // COM smart interface pointer ... // store interface in GIT ... (microsoft.public.vc.atl) - Re: What to do with 80040111
... > First I created instance with IID of interface that I can retrieve ... > interface with help of QueryInterface. ... > see pointer to problematic interface. ... > There is amazing behavior because _InternalQueryInterface() retrieves ... (microsoft.public.vc.atl) - Re: What to do with 80040111
... First I created instance with IID of interface that I can retrieve without ... The result is that _InternalQueryInterface() returns S_OK and I can see ... pointer to problematic interface. ... (microsoft.public.vc.atl) - Re: Global interface table release issue
... You obtain IGlobalInterfaceTable pointer with CoCreateInstance. ... CoCreateInstance to obtain an interface pointer (GIT or otherwise), ... (microsoft.public.vc.language) |
|