Home Help Center

the problem of using ByteSeq in slice(ice3.6.1 and visual studio 2013)

fengshenghelifengshengheli Member zhang mqOrganization: sddlProject: substation
I write a slice. The part of slice file below:
module Demo
{
sequence<byte> ByteSeq;

interface FileService
{
ByteSeq fileRead(string fileName, int initialPosition, out bool endOfFile);
};
};

It can generate .h and .cpp file. The server and client program complie well. But when call fileRead function, the service side code error.

::Ice::DispatchStatus
Demo::FileService::___fileRead(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
__checkMode(::Ice::Normal, __current.mode);
::IceInternal::BasicStream* __is = __inS.startReadParams();
::std::string __p_fileName;
::Ice::Int __p_initialPosition;
__is->read(__p_fileName);
__is->read(__p_initialPosition);
__inS.endReadParams();
bool __p_endOfFile;
::Demo::ByteSeq __ret = fileRead(__p_fileName, __p_initialPosition, __p_endOfFile, __current);
::IceInternal::BasicStream* __os = __inS.__startWriteParams(::Ice::DefaultFormat);
__os->write(__p_endOfFile);
__os->write(__ret);
__inS.__endWriteParams(true);
return ::Ice::DispatchOK;
}

::Demo::ByteSeq __ret = fileRead(__p_fileName, __p_initialPosition, __p_endOfFile, __current); call failed.
The error message "0x00407247 处有未经处理的异常(在 TestServer.exe 中): 0xC00000FD: Stack overflow (参数: 0x00000000, 0x01812000)。".

If i do not use ByteSeq in fileRead, it works ok.

It works using Ice3.4.1 with visual studio 2008.
But failed using Ice3.6.1 with visual studio 2013.

Comments

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    can you provide a complete sample program that allow us to reproduce the issue?

    Regards Jose
  • fengshenghelifengshengheli Member zhang mqOrganization: sddlProject: substation
    ​The project files size is 20M. I can not upload to the web. Can you give me your email?
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    We do not need the binaries, upload just the project file and the sources that will allow us to build it.
  • fengshenghelifengshengheli Member zhang mqOrganization: sddlProject: substation
    I only upload the source files.
    src.zip 16.9K
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Can you also post the complete stacktrace for the failure, looking at your code it is not clear this is related to Ice code.
  • fengshenghelifengshengheli Member zhang mqOrganization: sddlProject: substation
    When client call fileRead interface. The server code running to file file_service.cpp ___fileRead function.
    Attachment not found.

    I click F11 , running to the code file_service_i.cpp fileRead function.
    Attachment not found.


    I click F10 or F11, can not run to "endOfFile = false;".
    But error occured.

    Attachment not found.

    Other interface works ok. and if I change fileRead slice, don't use ByteSeq as return value or as out parameter, it work ok.
    So I guess the reason is ByteSeq using.
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    const Poco::Int32 maxReadBytes = 1024 * 1024;
    Ice::Byte buffer[maxReadBytes];
    

    This code might be problematic, as it allocates 1MB on the stack, which is the maximum if you are using the default compiler settings, see https://msdn.microsoft.com/en-us/library/tdkhxaks.aspx?f=255&MSPPError=-2147217396
  • fengshenghelifengshengheli Member zhang mqOrganization: sddlProject: substation
    It works ok after the code changed..
    const Poco::Int32 maxReadBytes = 1024*1000;

    or after modify the value of
    /STACK:reserve
    Thank you very much!

Sign In or Register to comment.