Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. Ref cnt > 0 for COM server

Ref cnt > 0 for COM server

Scheduled Pinned Locked Moved COM
comc++databasesysadmindebugging
3 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pros Chum
    wrote on last edited by
    #1

    I have a free threaded out-of-process COM server that after the clients release the interface the COM server's CComModule::Unlock() returns a value > 0. After the client first releases, the return value of Unlock() is 1, after the client loads and releases the second time the value is 2, and this continues to increase by one as I startup and shutdown the client. The client is using a smart pointer to the COM server interface. I also detached, the interface from the smart pointer in the destructor of my application and displayed the return value of Release() which is always 0. So it seems the client is releasing everything properly, it's just that the server isn't maintaining ref. count correctly for some reason. This causes the COM server to never shutdown. Any ideas why it keeps on increasing? I turned on ATL debugging and came out with the following output in the trace window. I also display the return of Unlock() for the lines that begin with "Unlock count: X". 1> CComClassFactory - IUnknown CComClassFactory - IUnknown Loaded 'C:\WINDOWS\SYSTEM\RPCRT4.DLL', no matching symbolic information found. 2> CComClassFactory - IUnknown 1< CComClassFactory - IUnknown 1> CComClassFactory - IClassFactory CComClassFactory - IClassFactory 1> CNREmail - IUnknown CNREmail - IUnknown 2> CNREmail - IUnknown CNREmail - IMarshal - failed CNREmail - {0000001B-0000-0000-C000-000000000046} - failed 3> CNREmail - IUnknown CNREmail - IUnknown 4> CNREmail - IUnknown CNREmail - IStdMarshalInfo - failed CNREmail - IExternalConnection - failed 3< CNREmail - IUnknown Unlock count: 3 1> CNREmail - INREmail CNREmail - INREmail Loaded '[My app's Proxy server].dll', no matching symbolic information found. 1> CNREmail - INREmail CNREmail - INREmail 2< CNREmail - IUnknown Unlock count: 4 1< CNREmail - IUnknown Unlock count: 3 0< CComClassFactory - IClassFactory Loaded 'C:\WINDOWS\SYSTEM\MSVCRT.DLL', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ole db\oledb32.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ole db\oledb32a.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\msjint40.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\msjter40.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\mswstr10.dll', no matching symbolic information found. Loaded 'C:\WINDO

    P 2 Replies Last reply
    0
    • P Pros Chum

      I have a free threaded out-of-process COM server that after the clients release the interface the COM server's CComModule::Unlock() returns a value > 0. After the client first releases, the return value of Unlock() is 1, after the client loads and releases the second time the value is 2, and this continues to increase by one as I startup and shutdown the client. The client is using a smart pointer to the COM server interface. I also detached, the interface from the smart pointer in the destructor of my application and displayed the return value of Release() which is always 0. So it seems the client is releasing everything properly, it's just that the server isn't maintaining ref. count correctly for some reason. This causes the COM server to never shutdown. Any ideas why it keeps on increasing? I turned on ATL debugging and came out with the following output in the trace window. I also display the return of Unlock() for the lines that begin with "Unlock count: X". 1> CComClassFactory - IUnknown CComClassFactory - IUnknown Loaded 'C:\WINDOWS\SYSTEM\RPCRT4.DLL', no matching symbolic information found. 2> CComClassFactory - IUnknown 1< CComClassFactory - IUnknown 1> CComClassFactory - IClassFactory CComClassFactory - IClassFactory 1> CNREmail - IUnknown CNREmail - IUnknown 2> CNREmail - IUnknown CNREmail - IMarshal - failed CNREmail - {0000001B-0000-0000-C000-000000000046} - failed 3> CNREmail - IUnknown CNREmail - IUnknown 4> CNREmail - IUnknown CNREmail - IStdMarshalInfo - failed CNREmail - IExternalConnection - failed 3< CNREmail - IUnknown Unlock count: 3 1> CNREmail - INREmail CNREmail - INREmail Loaded '[My app's Proxy server].dll', no matching symbolic information found. 1> CNREmail - INREmail CNREmail - INREmail 2< CNREmail - IUnknown Unlock count: 4 1< CNREmail - IUnknown Unlock count: 3 0< CComClassFactory - IClassFactory Loaded 'C:\WINDOWS\SYSTEM\MSVCRT.DLL', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ole db\oledb32.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ole db\oledb32a.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\msjint40.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\msjter40.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\mswstr10.dll', no matching symbolic information found. Loaded 'C:\WINDO

      P Offline
      P Offline
      Pros Chum
      wrote on last edited by
      #2

      Also, when I startup and shutdown the client, the reference count that is returned via the ATL header debug interface traces always returns 1 after the client shutsdown and doesn't increase like the unlock count returned from CComModule::Unlock() which increases by 1 each time.:confused:

      1 Reply Last reply
      0
      • P Pros Chum

        I have a free threaded out-of-process COM server that after the clients release the interface the COM server's CComModule::Unlock() returns a value > 0. After the client first releases, the return value of Unlock() is 1, after the client loads and releases the second time the value is 2, and this continues to increase by one as I startup and shutdown the client. The client is using a smart pointer to the COM server interface. I also detached, the interface from the smart pointer in the destructor of my application and displayed the return value of Release() which is always 0. So it seems the client is releasing everything properly, it's just that the server isn't maintaining ref. count correctly for some reason. This causes the COM server to never shutdown. Any ideas why it keeps on increasing? I turned on ATL debugging and came out with the following output in the trace window. I also display the return of Unlock() for the lines that begin with "Unlock count: X". 1> CComClassFactory - IUnknown CComClassFactory - IUnknown Loaded 'C:\WINDOWS\SYSTEM\RPCRT4.DLL', no matching symbolic information found. 2> CComClassFactory - IUnknown 1< CComClassFactory - IUnknown 1> CComClassFactory - IClassFactory CComClassFactory - IClassFactory 1> CNREmail - IUnknown CNREmail - IUnknown 2> CNREmail - IUnknown CNREmail - IMarshal - failed CNREmail - {0000001B-0000-0000-C000-000000000046} - failed 3> CNREmail - IUnknown CNREmail - IUnknown 4> CNREmail - IUnknown CNREmail - IStdMarshalInfo - failed CNREmail - IExternalConnection - failed 3< CNREmail - IUnknown Unlock count: 3 1> CNREmail - INREmail CNREmail - INREmail Loaded '[My app's Proxy server].dll', no matching symbolic information found. 1> CNREmail - INREmail CNREmail - INREmail 2< CNREmail - IUnknown Unlock count: 4 1< CNREmail - IUnknown Unlock count: 3 0< CComClassFactory - IClassFactory Loaded 'C:\WINDOWS\SYSTEM\MSVCRT.DLL', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ADO\msado15.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ole db\oledb32.dll', no matching symbolic information found. Loaded 'C:\Program Files\Common Files\SYSTEM\ole db\oledb32a.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\msjint40.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\msjter40.dll', no matching symbolic information found. Loaded 'C:\WINDOWS\SYSTEM\mswstr10.dll', no matching symbolic information found. Loaded 'C:\WINDO

        P Offline
        P Offline
        Pros Chum
        wrote on last edited by
        #3

        I figured it out. I had some worker threads in my COM server in which I was marshalling an interface pointer to itself, and had forgotten to call Release().

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups