Home Help Center

vector as out parameter

DmitriyDmitriy Member
I'm using sequence as output parametr, but on client side after completion
procedure, that calling server's method, I'm receive error.
This error - error deleting vector.
Tell me please, what i do incorrectly?
    //test.ice class Driver { int idDriver; string sDriverName; int idDriverStatus; int idDriverBase; string sDescription; }; sequence<Driver> TDriver; interface IDriver { int GetDrivers(int idClient,out TDriver vDriver); }

server code
    class _Driver : public IDriver { public: virtual int GetDrivers(int idClient,TDriver &,const Ice::Current &); }; int _Driver::GetDrivers(int idClient,TDriver & vDriver, const Ice::Current &) { for(int i=0;i<10;i++) { Driver* dr=new Driver(); dr->idDriver=i; dr->sDriverName=""; dr->idDriverStatus=i*i; dr->sDescription=""; dr->idDriverBase=i*i+i vDriver.push_back(dr); } return 1; }

and client
    ............ TDriver vDriver; pDriver->GetDrivers(ID,vDriver); return;

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    I can't see anything wrong with your code and I tried doing something similar and it worked fine. Can you please give more details on which Ice version you are using and which operating system? What error are you getting? If that's a crash (segementation fault, abort), can you you send us the stack trace of the crash?

    Benoit.
  • DmitriyDmitriy Member
    Ice version - 1.4.0
    OS - Windows XP
    I'm using VS 2003
    error is appear when vector on client free automaticaly...
    about stack tracer - hm.....
    I'm receive this error:
    Unhandled exception at 0x77f767cd in DriverClient.exe: User breakpoint.
    How I can see stack tracer?
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    One common reaon for memory errors is mistakenly mixing /MD and /MDd code.
    If you link with the Ice *d.lib libraries, you must compile your code with /MDd.
    If you link with the Ice release (no d) lib, you must compile your code with /MD.

    Also to get proper stack traces, you need to install the Ice PDB files (provided as a separate download).

    Cheers,
    Bernard
  • DmitriyDmitriy Member
    Ok.
    I'm link with the Ice *d.lib libraries, compile with /MDd.
    Debug output:
      'DriverClient.exe': Loaded 'C:\Dev\VC\Driver\DriverClient\Debug\DriverClient.exe', Symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\Dev\VC\Driver\DriverClient\Debug\ice14d.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\Dev\VC\Driver\DriverClient\Debug\iceutil14d.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\Dev\VC\Driver\DriverClient\Debug\msvcp70d.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\Dev\VC\Driver\DriverClient\Debug\msvcr70d.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\mfc71d.dll', Symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\msvcr71d.dll', Symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\shlwapi.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\comctl32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\ole32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\msvcp71d.dll', Symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\uxtheme.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\MSCTF.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\Usr\Panda Antivirus Platinum\Enganche.dll', No symbols loaded. First-chance exception at 0x77e73887 in DriverClient.exe: Microsoft C++ exception: CL_EXCEPCION_FINAL_FUNCION @ 0x0012e5ec. First-chance exception at 0x77e73887 in DriverClient.exe: Microsoft C++ exception: CL_EXCEPCION_FINAL_FUNCION @ 0x0012e727. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\mswsock.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\dnsapi.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\winrnr.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\wldap32.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\rasadhlp.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\WINDOWS\system32\wshtcpip.dll', No symbols loaded. 'DriverClient.exe': Loaded 'C:\Usr\Panda Antivirus Platinum\Firewall\SSSensor.dll', No symbols loaded. First-chance exception at 0x77e73887 in DriverClient.exe: Microsoft C++ exception: Ice::TimeoutException @ 0x0140e320. HEAP[DriverClient.exe]: Invalid Address specified to RtlValidateHeap( 00680000, 014D22B0 ) Unhandled exception at 0x77f767cd in DriverClient.exe: User breakpoint.
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    This stack trace shows your 'DriverClient.exe' dies because of an unhandled Ice::Timeout exception.

    When you call the distributed Ice operation, you should catch exceptions to avoid such crash.
    Then you need to figure out why you get a timeout. Maybe the operation on the the server-side takes too long?

    Cheers,
    Bernard
  • DmitriyDmitriy Member
    Ok.
    When I diminish data in vDriver, all work right.......
    Why?
    server initialization
      int argc = 0; Ice::PropertiesPtr properties = Ice::createProperties(); properties->setProperty("Driver.Endpoints", "tcp -p 9096"); properties->setProperty("Ice.Trace.Network", "1"); properties->setProperty("Ice.Warn.Connections", "1"); properties->setProperty("Ice.Override.ConnectTimeout","100000"); properties->setProperty("Ice.ThreadPool.Server.Size","10"); communicator = Ice::initializeWithProperties(argc, 0, properties); adapter = communicator->createObjectAdapter("Driver"); Ice::ObjectPtr servant = new _Driver; adapter->add(servant, Ice::stringToIdentity("driver")); adapter->activate(); communicator->waitForShutdown();

    and how to I can delete Driver objects (creating on server) in vDriver on Client?
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Originally posted by Dmitriy
    Ok.
    When I diminish data in vDriver, all work right.......
    Why?

    Sorry, from the information you provide it's not possible to say what's going wrong. We would need a small, self-contained code example that demonstrates the problem.

    For a code example that sends and receives sequences, have a look at demo/Ice/throughput.
    Originally posted by Dmitriy
    and how to I can delete Driver objects (creating on server) in vDriver on Client?

    You add a destroy() method to your Ice object, which the client can call. The implementation on the server then cleans up any resources associated with the Ice object, and removes the servant from the object adapter.
  • DmitriyDmitriy Member
    I find, that problem appear if string on server is big (about 10 chars)
      dr->sDriverName="This is Petrov Ivanovich"; //error on client
    and
      dr->sDriverName="1"; //ok
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Dmitry,

    Thanks for the example.

    I tried it on Windows XP with VS.NET 2003 and encountered the memory mismatch error. Then I realized that I was linking against the Ice 1.4.0 binary distribution for VS.NET 2002. After I installed the proper Ice binaries, I no longer received the error.

    Is it possible that you are using the Ice 1.4.0 binary distribution for VS.NET 2002?

    Take care,
    - Mark
  • DmitriyDmitriy Member
    Thank you very much!
    I uninstall Ice and install it anew. All work fine :)
Sign In or Register to comment.