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

Crash on interface invoke from an IceBox server


I am experiencing crashes in ice37.dll with icebox.exe and a simple demo application in C++ on the client side when AsyncResultPtr get destroyed.
Actually I try that one of my icebox service send on a regular periodicity a heartbeat signal with some status information. But in order to demonstrate the problem I do experience I made a simpler case


    interface TestInterface {
        idempotent int HeartbeatSum(int arg1, int arg2);

Client Side

void IceBoxTestServiceI::start(const string& serviceName,
const Ice::CommunicatorPtr& communicator,
const Ice::StringSeq& args) {

Ice::ObjectPrx base = communicator->stringToProxy("JSSGrid.Dispatcher/TestInterface");
Grid::InterfaceGrid::TestInterfacePrx _testInterfacePrx = Grid::InterfaceGrid::TestInterfacePrx::checkedCast(base);

if (_testInterfacePrx){
    cout << "Cast Success" << endl;

    try {
        cout << "ice_ping Sucess" << endl;
    catch (exception& e) {
            cout << "ice_ping Error : " << e.what() << endl;

    try {
        int i = 0;
        while (true) {
            try {
                cout << "Before begin_HeartbeatSum" << endl;
                Ice::AsyncResultPtr r = _testInterfacePrx->begin_HeartbeatSum(2, 3);
                cout << "begin_HeartbeatPing Sucess" << endl;

                int res = _testInterfacePrx->end_HeartbeatSum(r);
                cout << "end_HeartbeatSum Sucess" << endl;

                cout << "Res : " << res << endl;
                cout << "isSent : " << r->isSent() << endl;
                cout << "isCompleted : " << r->isCompleted() << endl;

            catch (exception& e) {
                cout << "HeartbeatSum Error : " << e.what() << endl;
            cout << "Done : " << i << " loop" << endl;
    catch (exception& e) {
        cout << "HeartbeatSum LOOP Error : " << e.what() << endl;
else {
    cout << "Cast Failed" << endl;

cout << "Done2" << endl;



Cast Success
ice_ping Sucess
Before begin_HeartbeatSum
begin_HeartbeatSum Sucess
end_HeartbeatSum Sucess
Res : 5
isSent : 1
isCompleted : 1

As you can see the loop is stopped before the end as soon as Ice::AsyncResultPtr instance gets out of scope.
=> Declaring the variable outside the loop makes the loop finishing but crashes then on a new call to begin_HeartbeatSum
=> Using synchronous call crashes immediately (since the intermediate AsyncResultPtr is destroyed before returning, right ?)
=> I have no problem when the call is made from a stand-alone executable rather than icebox ...

Do you have any idea why this happens ? I did a lot of experiments to get rid of that issue without success and now I am out of idea to solve that. ay be I will try to test this example with ice 3.6.

Thanks in advance for any help you can provide,
Best regards



  • xdm
    xdm La Coruña, Spain


    Can you clarify what Visual Studio version are you using to build your service, and what icebox executable are you using to deploy it?

    On Windows you must use an icebox executable that is compatible with the service, this means it has been build with the same compiler, platform and configuration.

    For example if you are doing Visual Studio 2017 x64 release build you must use\build\native\bin\x64\Release\icebox.exe

  • Hi.

    Thanks for your reactive answer, I watched my mail for an answer but actually the forum did not notify (user's setting?). Next time I will be more reactive.

    Sorry I forgot to mention : Visual Studio 2013 x64 (because I use other libraries that prevent me to use later versions)
    And I use\build\native\bin\x64\release\ice37.dll & icebox37.dll

    For Icebox.exe it uses the one installed with Ice-3.7.0.msi in C:\Program Files\ZeroC\Ice-3.7.0\bin\icebox.exe
    since it is the standard 3.7 x64 distribution.

    Is there some incompatibility I should take care about ?


  • That is great : I just did try your advise and using\build\native\bin\x64\release\x64 solves the problem.

    But this exe comes from the nugget package. So I am confused, I cannot deploy the .msi file on my target machines, I must use the nugget package ?

  • xdm
    xdm La Coruña, Spain

    You need to use icebox.exe build with the same compiler in that case\build\native\bin\x64\release\icebox.exe otherwise you end up loading different C/C++ run-times that could explain the crash you saw

  • bernard
    bernard Jupiter, FL

    The icebox.exe provided in the Ice 3.7.0 MSI is a x64 exe built with Visual Studio 2015, like other exe and DLLs provided by this MSI. See for more details.

    While you can use this icebox.exe with your own IceBox services (if you built them with VS2015 x64 release), it's primarily in the MSI for the IceStorm service (IceStorm is packaged as an IceBox service).

    We recommend that you package up your Ice-based applications using the NuGet packages - ship the Ice exe and DLLs you need (from the NuGet) alongside your own exes and DLLs. And that's exactly how we build the Ice MSI, using DLLs and exes from the v140 NuGet package.

    Best regards,

  • The help provided here works and the problem is solved with rebuilding a distribution based on the nugget package.
    How can I accept your answer (the answer from Bernard 27.12.2017@6.26PM) ? I do not see any button on my browser...

  • xdm
    xdm La Coruña, Spain

    I change the thread type to Q&A it was created as a discussion, you will be able to set the accept answer now.


  • Tanks xdm
    Your answer was also fine but Bernard's was more extensive