rdmenezes / rcf-cpp

Automatically exported from code.google.com/p/rcf-cpp
0 stars 0 forks source link

OS: 10054 - An existing connection was forcibly closed by the remote host #36

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build the following code from the tutorial 

// Attached the header and source file so you can see defines we use to build 
RCF library
//
#include "../../src/libRCF.h"

#include <iostream>
RCF_BEGIN(I_X, "I_X")
    RCF_METHOD_R2(int, add, int, int)
RCF_END(I_X)
class X
{
public:
    int add(int a, int b) { return a+b; }
};

int main (int, char **)
{
    RCF::init();

    std::string format = "%B %E(%F): (Tid:%D)(Time::%H): %X";
    util::LoggerPtr loggerPtr = util::LoggerPtr(new util::Logger ( RCF::LogNameRcf, 4, util::LogToStdout(), format ));
    loggerPtr->activate();

    //>>> BDM: temp
    X x;
    RCF::RcfServer server( RCF::TcpEndpoint(0));
    server.bind<I_X>(x);
    server.start();

    try
    {
        int port = server.getIpServerTransport().getPort();

        int a = 2;
        int b = 3;
        std::cout 
            << "Client: requesting addition of " 
            << a << " and " << b << std::endl;

        int sum = RcfClient<I_X>( RCF::TcpEndpoint(port)).add(a,b);

        std::cout << "Client: server responded with " << sum << std::endl;
    }
    catch(const std::exception &e)
    {
        std::cout << "Caught exception:\n";
        std::cout << "Type: " << typeid(e).name() << "\n";
        std::cout << "What: " << e.what() << "\n";
    }

    RCF::deinit();
    return 0;
}

2. Build and run/step through it
3. Client throws exception about connection being forcibly closed by server

What is the expected output? What do you see instead?

From the Logs:

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\RcfServer.cpp(121): (Tid:6920)(Time::16): 
RcfServer - adding service. [Args: typeid(*servicePtr).name()=class 
RCF::TcpAsioServerTransport, ]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\RcfServer.cpp(1131): 
(Tid:6920)(Time::16): RcfServer - exposing static binding. [Args: name=I_X, ]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\TcpAsioServerTransport.cpp(344): 
(Tid:6920)(Time::31): TcpAsioServerTransport - listening on port 52672.

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\TcpAsioServerTransport.cpp(143): 
(Tid:6920)(Time::47): TcpAsioSessionState - calling async_accept().

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\RcfServer.cpp(425): 
(Tid:6920)(Time::47):RcfServer - starting service. [Args: 
typeid(*servicePtr).name()=class RCF::TcpAsioServerTransport, ]Client: 
requesting addition of 2 and 3

3 C:\dev\3rdParty\RCF\RCF-1.3\include\RCF/Marshal.hpp(2004): 
(Tid:6920)(Time::63): RcfClient - sending synchronous request. [Args: 
mpClientStub=01D87F38, mpClientStub->mRequest=(r.mToken = ( id = 0 
))(r.mSubInterface = I_X)(r.mFnId = 0)(r.mSerializationProtocol = 
1)(r.mMarshalingProtocol = 1)(r.mOneway = 0)(r.mClose =0)(r.mService = 
I_X)(r.mRuntimeVersion = 8)(r.mPingBackIntervalMs = 0)(r.mArchiveVersion = 0), ]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\Marshal.cpp(155): (Tid:6920)(Time::94): 
RcfClient - connect to server. [Args: this=01D87F38, endpoint=TCP endpoint 
127.0.0.1:52672, mConnectTimeoutMs=2000, ]

4 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(417): 
(Tid:6920)(Time::109): ConnectionOrientedClientTransport - initiating timed 
send operation. [Args: lengthByteBuffers(data)=62, totalTimeoutMs=9985, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\AsioServerTransport.cpp(524): 
(Tid:12048)(Time::109): AsioSessionState - onAccept(). [Args: error.value()=0, ]

4 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(679): 
(Tid:6920)(Time::109): ConnectionOrientedClientTransport - initiating write. 
[Args: lengthByteBuffers(byteBuffers)=62, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\TcpAsioServerTransport.cpp(143): 
(Tid:12048)(Time::125): TcpAsioSessionState - calling async_accept().

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\BsdClientTransport.cpp(304): 
(Tid:6920)(Time::141): BsdClientTransport - initiating send on socket. [Args: 
lengthByteBuffers(byteBuffers)=62, ]

3 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\RcfServer.cpp(687): 
(Tid:12048)(Time::156): RcfServer - completed sending of response. [Args: 
this=01D86508, ]

4 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(670): 
(Tid:6920)(Time::156): ConnectionOrientedClientTransport - initiating read. 
[Args: bytesToRead=4, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\TcpAsioServerTransport.cpp(97): 
(Tid:12048)(Time::172): TcpAsioSessionState - calling async_read_some(). [Args: 
bufferLen=0, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\BsdClientTransport.cpp(182): 
(Tid:6920)(Time::188): BsdClientTransport - initiating read from socket. [Args: 
byteBuffer.getLength()=4, bytesToRead=4, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\AsioServerTransport.cpp(389): 
(Tid:12048)(Time::188): AsioSessionState - read from socket completed. [Args: 
this=01D85E08, bytesTransferred=0, ]

4 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\AsioServerTransport.cpp(265): 
(Tid:12048)(Time::219): AsioSessionState - destructor. [Args: mState=2, 
mSessionPtr.get()=01D86508, mHasBeenClosed=0, ]

1 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(338): 
(Tid:6920)(Time::219): Exception thrown. [RCF: 31: Client read operation 
failed. OS: 10054 - An existing connection was forcibly closed by the remote 
host.]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ClientStub.cpp(457): 
(Tid:6920)(Time::250): RcfClient - disconnecting from server. [Args: 
this=01D87F38, endpoint=TCP endpoint 127.0.0.1:52672, ]

2 c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ClientStub.cpp(457): 
(Tid:6920)(Time::250): RcfClient - disconnecting from server. [Args: 
this=01D87F38, endpoint=TCP endpoint 127.0.0.1:52672, ]

Caught exception:
Type: class RCF::Exception
What: [31: Client read operation failed. OS: 10054 - An existing connection was 
forcibly closed by the remote host.][1: Operating system][10054: An existing 
connection was forcibly closed by the remote host.][What: ][Context: 
c:\dev\3rdparty\rcf\rcf-1.3\src\rcf\ConnectionOrientedClientTransport.cpp(338): 
void __thiscall 
RCF::ConnectionOrientedClientTransport::onTimedRecvCompleted(int,int): : 
Thread-id=6920 : Timestamp(ms)=219: : ]

What version of the product are you using? On what operating system?

RCF 1.3 on 32 bit Windows (both Vista and 2000 Pro), Building and running in 
Visual Studio 2010

Please provide any additional information below.

I tried debugging this with no luck. I built the (almost) exact same code 
against RCF 1.1 and it works perfectly. The only difference was the removal of 
the logging setup since that was added in 1.3.

Original issue reported on code.google.com by bdmolin...@gmail.com on 28 Jan 2011 at 11:25

Attachments:

GoogleCodeExporter commented 9 years ago
Deleted the attached files since it's just clutter. Here are the defines used 
when I build RCF:

//RCF CONFIGURATION OPTIONS:
#define RCF_NO_AUTO_INIT_DEINIT
#define RCF_MULTI_THREADED
#define RCF_USE_BOOST_THREADS
#define RCF_USE_BOOST_ASIO
#define RCF_USE_OPENSSL 
#define RCF_USE_ZLIB

Original comment by bdmolin...@gmail.com on 28 Jan 2011 at 11:31

GoogleCodeExporter commented 9 years ago
Another update. This seems to be only happen when RCF_USE_BOOST_ASIO is 
defined!!

Original comment by bdmolin...@gmail.com on 28 Jan 2011 at 11:35

GoogleCodeExporter commented 9 years ago
Are you by any chance using Boost.Asio 1.42.0 ? There is a serious bug in that 
version, and RCF won't work with it...

http://deltavsoft.com/w/RcfUserGuide/1.3/rcf_user_guide/Building.html#rcf_user_g
uide.Building.Libraries

http://deltavsoft.com/w/RcfUserGuide/1.3/rcf_user_guide/FAQ.html#rcf_user_guide.
FAQ.Building.AsioRegression1420

Original comment by jarl.lin...@gmail.com on 15 Feb 2011 at 12:35

GoogleCodeExporter commented 9 years ago
Yes I am. Sorry, don't know how I missed that in the FAQ. Thanks for the 
response!

Original comment by bdmolin...@gmail.com on 16 Feb 2011 at 9:55