Open GoogleCodeExporter opened 9 years ago
I've done some testing, and was able to send 1 MB messages back and forth
between client and server, with the OpenSSL filter, 100 times, without any
problems.
I'm using RCF 1.3, which may make a difference. Can you try with 1.3
(http://deltavsoft.com/w/download.html) , and see if you still get the error?
Original comment by jarl.lin...@gmail.com
on 31 Dec 2010 at 2:49
Then I don't really understand why by disabling OpenSSL transport filters I see
no problems in the same test application.
Can you please send me your sample client/server implementation which sends 1mb
of data back and forth over openssl transport filter.
I'm using RCF-1.3 and openssl-0.9.8o.
Thanks.
Original comment by zoltan.b...@gmail.com
on 3 Jan 2011 at 7:13
I've attached the sample code I've used. Look for "// sending large messages".
Original comment by jarl.lin...@gmail.com
on 7 Jan 2011 at 12:27
Attachments:
I get the stack overflow when running your sample.
The exception occurs right when client.echo(s0) is called in "sending large
messages" block.
Here is the sample output:
Defines:
BOOST_VERSION: 104500
RCF_MAX_METHOD_COUNT: 100
RCF_MULTI_THREADED
RCF_USE_SF_SERIALIZATION
RCF_USE_OPENSSL
RCF_TEMP_DIR:
*********************
and exception:
Unhandled exception at 0x0034e8c9 in RFC_PipeTestSSL.exe: 0xC00000FD: Stack
overflow.
The stack trace is attached.
I'm using MSVC2008(9.0) with SP1, on Win7, 32 bit.
Original comment by zoltan.b...@gmail.com
on 7 Jan 2011 at 9:28
Attachments:
The test code works on my machines, but there are some environmental
differences, in particular I don't think we're using the same version of
OpenSSL.
The stack trace shows pretty clearly what is going on though. I've fixed the
stack recursion that is causing the overflow - if you apply the attached patch
to RCF 1.3, it should take care of the issue.
Original comment by jarl.lin...@gmail.com
on 9 Jan 2011 at 12:00
Attachments:
Can you please let me know what OpenSSL version your are using?
Thanks for the patch, I will apply it asap.
Original comment by zoltan.b...@gmail.com
on 11 Jan 2011 at 10:47
I'm using OpenSSL 0.9.7c in my testing environment...
Original comment by jarl.lin...@gmail.com
on 12 Jan 2011 at 10:26
Hello,
The patch did really fix the problem with recursion, thanks.
But I'm having another issue sending big chunks of data over SSL.
Can you please try to split client and server into different projects and run
separately?
Your OpenSSL filter sample works OK when client/server are started within one
application.
But if you try to start them separately the client chokes up with the following
exception after iterating over several times, sending 1MB data.
Please note I'm using Win32 Named Pipes as a transport.
If I skip the exception below, I get the following error message from the
client.echo() call:
Failed to echo: [75] Pipe error. OS: 109 - The pipe has been ended.
And here is the stack trace when I get the exception:
KernelBase.dll!RaiseException() + 0x54 bytes
[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]
msvcr90d.dll!_CxxThrowException(void * pExceptionObject=0x0013bcd0, const _s__ThrowInfo * pThrowInfo=0x01818768) Line 161 C++
> RFC_PipeTestSSL.exe!util::detail::InvokeThrow<RCF::Exception>::invoke(const
std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
context="d:\dev2008\samples\rcf-1.3\src\rcf\win32namedpipeclienttransport.cpp(30
0): unsigned int __thiscall RCF::Win32NamedPipeClientTransport::implRead(const
class RCF::ByteBuffer &,unsigned int): : Thread-id=5056 : Timestamp(ms)=9142: :
", const std::basic_string<char,std::char_traits<char>,std::allocator<char> > &
args="", int logName=1, int logLevel=1, const char * file=0x017773b8, int
line=300, const char * func=0x01777918) Line 83 C++
RFC_PipeTestSSL.exe!util::ThrowFunctor::~ThrowFunctor() Line 158 + 0x51 bytes C++
RFC_PipeTestSSL.exe!util::VariableArgMacro<util::ThrowFunctor>::~VariableArgMacro<util::ThrowFunctor>() Line 185 + 0x34 bytes C++
RFC_PipeTestSSL.exe!RCF::Win32NamedPipeClientTransport::implRead(const RCF::ByteBuffer & byteBuffer={...}, unsigned int bytesRequested=2048) Line 300 + 0x15e bytes C++
RFC_PipeTestSSL.exe!RCF::ConnectionOrientedClientTransport::read(const RCF::ByteBuffer & byteBuffer_={...}, unsigned int bytesRequested=2048) Line 310 + 0x1f bytes C++
RFC_PipeTestSSL.exe!RCF::ClientFilterProxy::read(const RCF::ByteBuffer & byteBuffer={...}, unsigned int bytesRequested=2048) Line 41 + 0x4e bytes C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilterImpl::transferData() Line 523 + 0x32 bytes C++
RFC_PipeTestSSL.exe!RCF::applyRecursionLimiter<RCF::RecursionState<int,int>,RCF::OpenSslEncryptionFilterImpl,void (__thiscall RCF::OpenSslEncryptionFilterImpl::*)(void)>(RCF::RecursionState<int,int> & state={...}, void (void)* pfn=0x012391bc, RCF::OpenSslEncryptionFilterImpl & x={...}) Line 116 + 0x8 bytes C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilterImpl::retryReadWrite() Line 473 + 0x18 bytes C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilterImpl::readWrite() Line 415 C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilterImpl::write(const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & byteBuffers=[0]()) Line 354 C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilter::write(const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & byteBuffers=[0]()) Line 234 C++
RFC_PipeTestSSL.exe!RCF::ClientFilterProxy::write(const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & byteBuffers=[0]()) Line 48 + 0x26 bytes C++
RFC_PipeTestSSL.exe!RCF::ConnectionOrientedClientTransport::issueWrite(const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & byteBuffers=[0]()) Line 683 + 0x61 bytes C++
RFC_PipeTestSSL.exe!RCF::ConnectionOrientedClientTransport::transition() Line 747 C++
RFC_PipeTestSSL.exe!RCF::ConnectionOrientedClientTransport::send(RCF::I_ClientTransportCallback & clientStub={...}, const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & data=[0](), unsigned int totalTimeoutMs=3600000) Line 434 C++
RFC_PipeTestSSL.exe!RCF::ClientStub::onConnectCompleted(bool alreadyConnected=true) Line 310 + 0x35 bytes C++
RFC_PipeTestSSL.exe!RCF::ClientStub::connect() Line 170 + 0x11 bytes C++
RFC_PipeTestSSL.exe!RCF::ClientStub::send() Line 362 C++
RFC_PipeTestSSL.exe!RCF::ClientStub::call(RCF::RemoteCallSemantics rcs=Twoway) Line 672 C++
RFC_PipeTestSSL.exe!RCF::FutureImpl<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::callSync() Line 2010 C++
RFC_PipeTestSSL.exe!RCF::FutureImpl<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::call() Line 1993 C++
RFC_PipeTestSSL.exe!RCF::FutureImpl<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::operator std::basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 1940 C++
RFC_PipeTestSSL.exe!test_main(int argc=1, char * * argv=0x00624fe0) Line 143 + 0x3e bytes C++
RFC_PipeTestSSL.exe!main(int argc=1, char * * argv=0x00624fe0) Line 198 + 0xd bytes C++
RFC_PipeTestSSL.exe!__tmainCRTStartup() Line 586 + 0x19 bytes C
RFC_PipeTestSSL.exe!mainCRTStartup() Line 403 C
kernel32.dll!BaseThreadInitThunk() + 0x12 bytes
ntdll.dll!RtlInitializeExceptionChain() + 0x63 bytes
ntdll.dll!RtlInitializeExceptionChain() + 0x36 bytes
Original comment by zoltan.b...@gmail.com
on 14 Feb 2011 at 9:10
I've split the test code into separate client and server processes, but am
unable to reproduce the error... The code is attached - you can try to run it
in your environment.
Original comment by jarl.lin...@gmail.com
on 15 Feb 2011 at 12:29
Attachments:
Thanks for the sample.
The only difference I found in my code is that I setup thread pool right before
starting the server:
std::size_t targetThreadCount = 1;
std::size_t maxThreadCount = 100;
std::string threadName = "RCF Server";
boost::uint32_t threadIdleTimeoutMs = 60*1000;
RCF::ThreadPoolPtr threadPoolPtr(
new RCF::ThreadPool(
targetThreadCount,
maxThreadCount,
threadName,
threadIdleTimeoutMs) );
server.setThreadPool(threadPoolPtr);
server.start();
Can you please try to add this piece of code in your SslServer process and let
me know if you can reproduce the error.
I get RCF::Exception with error code 232(The pipe is being closed.) after
several iterations on the client side. If no thread pool is used, then I don't
get any exceptions.
thanks.
Original comment by zoltan.b...@gmail.com
on 16 Feb 2011 at 8:18
Thanks, that did the trick... There was a thread safety problem in the OpenSSL
filter, easy enough to fix. I'm attaching an updated version of
OpenSslEncryptionFilter.cpp, that should fix the problem.
Original comment by jarl.lin...@gmail.com
on 16 Feb 2011 at 9:22
Attachments:
I don't think the problem is resolved yet.
I'm still getting the exception on the client side after several iterations.
The exception is thrown with error code 109(The pipe has been ended.)
Here is the stack trace:
KernelBase.dll!RaiseException() + 0x54 bytes
[Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]
msvcr90d.dll!_CxxThrowException(void * pExceptionObject=0x002ac5e8, const _s__ThrowInfo * pThrowInfo=0x0192f464) Line 161 C++
RFC_PipeTestSSL.exe!util::detail::InvokeThrow<RCF::Exception>::invoke(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & context="d:\dev2008\samples\rcf-1.3\src\rcf\win32namedpipeclienttransport.cpp(300): unsigned int __thiscall RCF::Win32NamedPipeClientTransport::implRead(const class RCF::ByteBuffer &,unsigned int): : Thread-id=2376 : Timestamp(ms)=1497: : ", const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & args="", int logName=1, int logLevel=1, const char * file=0x018913e0, int line=300, const char * func=0x01891940) Line 83 C++
RFC_PipeTestSSL.exe!util::ThrowFunctor::~ThrowFunctor() Line 158 + 0x51 bytes C++
RFC_PipeTestSSL.exe!util::VariableArgMacro<util::ThrowFunctor>::~VariableArgMacro<util::ThrowFunctor>() Line 185 + 0x34 bytes C++
> RFC_PipeTestSSL.exe!RCF::Win32NamedPipeClientTransport::implRead(const
RCF::ByteBuffer & byteBuffer={...}, unsigned int bytesRequested=2048) Line 300
+ 0x15e bytes C++
RFC_PipeTestSSL.exe!RCF::ConnectionOrientedClientTransport::read(const RCF::ByteBuffer & byteBuffer_={...}, unsigned int bytesRequested=2048) Line 310 + 0x1f bytes C++
RFC_PipeTestSSL.exe!RCF::ClientFilterProxy::read(const RCF::ByteBuffer & byteBuffer={...}, unsigned int bytesRequested=2048) Line 41 + 0x4e bytes C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilterImpl::transferData() Line 524 + 0x32 bytes C++
RFC_PipeTestSSL.exe!RCF::applyRecursionLimiter<RCF::RecursionState<int,int>,RCF::OpenSslEncryptionFilterImpl,void (__thiscall RCF::OpenSslEncryptionFilterImpl::*)(void)>(RCF::RecursionState<int,int> & state={...}, void (void)* pfn=0x013842e8, RCF::OpenSslEncryptionFilterImpl & x={...}) Line 116 + 0x8 bytes C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilterImpl::retryReadWrite() Line 474 + 0x18 bytes C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilterImpl::readWrite() Line 416 C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilterImpl::write(const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & byteBuffers=[0]()) Line 354 C++
RFC_PipeTestSSL.exe!RCF::OpenSslEncryptionFilter::write(const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & byteBuffers=[0]()) Line 234 C++
RFC_PipeTestSSL.exe!RCF::ClientFilterProxy::write(const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & byteBuffers=[0]()) Line 48 + 0x26 bytes C++
RFC_PipeTestSSL.exe!RCF::ConnectionOrientedClientTransport::issueWrite(const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & byteBuffers=[0]()) Line 683 + 0x61 bytes C++
RFC_PipeTestSSL.exe!RCF::ConnectionOrientedClientTransport::transition() Line 747 C++
RFC_PipeTestSSL.exe!RCF::ConnectionOrientedClientTransport::send(RCF::I_ClientTransportCallback & clientStub={...}, const std::vector<RCF::ByteBuffer,std::allocator<RCF::ByteBuffer> > & data=[0](), unsigned int totalTimeoutMs=3600000) Line 434 C++
RFC_PipeTestSSL.exe!RCF::ClientStub::onConnectCompleted(bool alreadyConnected=true) Line 310 + 0x35 bytes C++
RFC_PipeTestSSL.exe!RCF::ClientStub::connect() Line 170 + 0x11 bytes C++
RFC_PipeTestSSL.exe!RCF::ClientStub::send() Line 362 C++
RFC_PipeTestSSL.exe!RCF::ClientStub::call(RCF::RemoteCallSemantics rcs=Twoway) Line 672 C++
RFC_PipeTestSSL.exe!RCF::FutureImpl<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::callSync() Line 2010 C++
RFC_PipeTestSSL.exe!RCF::FutureImpl<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::call() Line 1993 C++
RFC_PipeTestSSL.exe!RCF::FutureImpl<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::operator std::basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 1940 C++
RFC_PipeTestSSL.exe!main() Line 79 + 0x3e bytes C++
RFC_PipeTestSSL.exe!__tmainCRTStartup() Line 586 + 0x19 bytes C
RFC_PipeTestSSL.exe!mainCRTStartup() Line 403 C
Original comment by zoltan.b...@gmail.com
on 16 Feb 2011 at 10:55
Have you rebuilt your server with the updated OpenSslEncryptionFilter.cpp, or
just the client ? The problem I found was on the server-side; the client
exception is just a downstream consequence of the server terminating the
connection.
Can you attach to the server with a debugger, and see if any exceptions are
being thrown?
Original comment by jarl.lin...@gmail.com
on 16 Feb 2011 at 11:03
Yes, I have rebuilt both client and server after updating
OpenSslEncryptionFilter.cpp.
Server doesn't throw any exceptions while debugging, double checked this.
I only get the exception from the client while enabling thread pool on the
server side.
thanks.
Original comment by zoltan.b...@gmail.com
on 16 Feb 2011 at 11:14
Hello,
Did you have a chance to reproduce the problem I'm having?
If you need more info which could help you to analyze the issue, please let me
know.
regards.
Original comment by zoltan.b...@gmail.com
on 18 Feb 2011 at 6:13
Yeah I've got the problem to reproduce in my environment as well... I'll post
an update as soon as it's resolved.
Original comment by jarl.lin...@gmail.com
on 18 Feb 2011 at 7:59
OK - looks like there was a problem with the earlier fix to prevent excessive
client-side recursion. It erroneously affected the server-side code path as
well.
It should be fixed now. See how you go with the attached code... On my machine
the sample SSL client and server (multithreaded) now run through without
problems.
Original comment by jarl.lin...@gmail.com
on 18 Feb 2011 at 1:06
Attachments:
Original issue reported on code.google.com by
zoltan.b...@gmail.com
on 24 Dec 2010 at 3:36