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

Question on the IcePack implementation


As I have some hassle around a Ice::Service implementation I did (probably a nice race condition), I took a look at the implementation of IcePackNode and IcePackRegistry which also implement the Ice::Service interface.

Maybe the question is a bit stupid, but can you tell me why you simply "return true;" in e.g. IcePack::NodeService::shutdown().

I tried to do the same in my app, mimmicking the behaviour of the two apps mentioned above but this didn't lead into progress for the shutdown. Instead, the application was stuck and pressing Ctrl+C (in application mode) again and again yielding in yet new calls of shutdown(). I.e., stop() was never called, where the communicator is shut down.

When calling Ice::Service::shutdown(), i.e.

bool MyService::shutdown()
// something
return Ice::Service::shutdown();

instead, everything went well. I know what Ice::Service::shutdown() does (I've read the sources :) ), but why does the code work in your case and doesn't work in mine. Did I miss some other code hidden in the IcePack services that allows your code to work?




  • benoit
    benoit Rennes, France
    I must admit that I don't know why we return a boolean from this method :o I'll check with my colleagues this week.

    As for your issue, the best is to get a dump of the stack traces when the hang occurs and post them here. I'm sure it will be much easier to figure out what's wrong once we see where it hangs.

    We're not doing anything special in the IcePack node or registry service implementation to make it work ;). Note that you must just make sure to call the method main() of the service before creating any threads.

  • Thanks for your answer. Sorry that my question was target a bit to far down to the guts of IcePack :) It'd be cool anyway to find out why you did like you did.

    What I'd like to ask, sorry for mis-using the thread, do you have an idea how I can dump a stack trace? The win32 version of strace probably won't help much as I'd have to do something like 'srvany strace myapp.exe' and thus the usual service behavior of my app wouldn't be available. It would run in app mode instead. I've been thinking about this for a couple of days now but don't have no clue how to solve it :(

    On the other hand, when attaching the debugger to the process, everything I have is a disassembly of my app with the point of error being marked but e.g. no call stack...

    How do you debug such things during Ice development (if this isn't beyond free support :) )?

  • benoit
    benoit Rennes, France
    You should be able to attach the Visual C++ debugger with the process and stop its execution when it hangs. If you only see assembly instructions in the call stack it's probably because you didn't compile your binaries with debug information enabled.

    Check out the Ice demo projects, you'll see that each project has settings for building in debug or release mode. You can use these projects as an example for your projects. Also, you must make sure to link with iced.lib when building your application in debug mode.

    Hope this helps!