Archived
This forum has been archived. Please start a new discussion on GitHub.
the problem of using ByteSeq in slice(ice3.6.1 and visual studio 2013)
fengshengheli
in Help Center
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.
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.
0
Comments
-
-
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.0 -
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=-21472173960
