Archived

This forum has been archived. Please start a new discussion on GitHub.

Remove Ice Threads after ice client has closed

Hello,

I connect my Application with an external software via ice. The external software already has an integrated ice server, so I only wrote the ice client.
The connection is successfull, but I have a problems with still living ice threads after the ice client is closed.
The ice client exist as long as an connection exist, afterwards the ice client object is destroyed while the application is still running.

The ice client is written in C++ and inherit from Ice::Application. I am sure the Communicator object is destroyed and the main function has ended (which should destroy the Communicator automatically), before the ice client object is deleted.
The ice threads (5-6 Threads) still exist after the ice client object was deleted.

What can I do to close these threads?

Comments

  • benoit
    benoit Rennes, France
    Hi

    It isn't clear to me what you are referring to with the "ice client object". In any case, destroying the Ice communicator should destroy the threads allocated internally by Ice. If you're using the Ice::Application helper, the communicator should be destroyed once the Ice::Application::main() function returns.

    Which Ice version are you using? Are the threads which are left around threads in the client or the server?

    Cheers,
    Benoit.
  • Hi,

    The Ice client use ice version 3.5.1 the ice server use 3.4.1. The used Encoding Version is 1.0.
    All threads belong to the ice client.
    I mean with "ice client object" the instance from my ice client class which I use to communicate with the other application. I use only one ice client in my application.
    My ice client object is running in its own thread, which is closed after the destructor from ice client was called
  • bernard
    bernard Jupiter, FL
    Hi Henning,

    As Benoit wrote earlier, the Ice::Application class created its own Ice communicator object and destroys this Ice communicator object when Ice::Application::main returns.

    The destruction of the Ice communicator object terminates and joins all threads created by the communicator. Communicator::destroy (unlike Communicator::shutdown) can block - it waits for the threads for finish. So you should definitely not see any Ice thread in your application after your communicator (the Ice::Application's internal communicator in this case) has been destroyed.

    Independently of this issue, does your application really need to create and destroy over and over its Ice client? Creating this Ice client the first time you need it and then keeping it around seems much simpler.

    Best regards,
    Bernard