Sample do not run on Win 8

RCF support and general discussion.
john06
Posts: 11
Joined: Thu Sep 20, 2012 2:10 pm

Sample do not run on Win 8

Post by john06 »

Hello,

The Server Client samples built with VS2012 ran well on my Win7 desktop, but doesn't on Win8, AFAIK with same settings, no firewall, and on a local computer.
I ran with a Debug output window, there is no trace.

So two questions:
1- Is someone has made a RCF Win7 test ?
2- As I don't have any error/warning, is there a way to enable error log ?

Thanks a lot,

john06
Posts: 11
Joined: Thu Sep 20, 2012 2:10 pm

Re: Sample do not run on Win 8

Post by john06 »


john06
Posts: 11
Joined: Thu Sep 20, 2012 2:10 pm

Re: Sample do not run on Win 8

Post by john06 »

But RCF::enableLogging( is not defined in source code :-(

john06
Posts: 11
Joined: Thu Sep 20, 2012 2:10 pm

Re: Sample do not run on Win 8

Post by john06 »

That is working :

RCF::RcfInitDeinit rcfInit;

// init log
std::string logFormat( "%E(%F): %X" ); // used at Log.cpp line#510
RCF::LogManager::init();
RCF::LogManager::instance().activateLogger( RCF::LoggerPtr( new
RCF::Logger( RCF::LogNameRcf, RCF::LogLevel_4, RCF::LogToStdout(), logFormat ) ) );
RCF::LogManager::instance().activateLogger( RCF::LoggerPtr( new
RCF::Logger( RCF::LogNameRcf, RCF::LogLevel_4, RCF::LogToDebugWindow(), logFormat ) ) );

RCF_LOG_1() << "Is RCF_LOG_1() working ? " ;

john06
Posts: 11
Joined: Thu Sep 20, 2012 2:10 pm

Re: Sample do not run on Win 8

Post by john06 »

Hello,
I'm definitively unable to make working the server/client Demo program on a Windows 8 OS.
Easy to reproduce with a virtual Windows 8, (I use the Oracle Virtual Box and the free version of Windows 8 Pro).
In order to investigate, I have run successfully many Boost::ASIO samples, I have enabled level 4 log in the Demo, the only message is coming from the client is "Remote call timeout exceeded. No response from peer."
I use latest Boost 1.51.0, with static memory model.
The same binaries runs on Win 7.
I have tried to follow step by step in debugger, but at least need your help in order to be more efective ...

Nevertheless, on this occasion I think I found a potential problem in IpAddress::createSocket with this code:

RCF_VERIFY(
fd != -1,
Exception(
_RcfError_Socket("socket()"), err, RcfSubsystem_Os));

MSDN doc says that error code is INVALID_SOCKET (0), not -1 as in the code.

Best regards,

Jean

john06
Posts: 11
Joined: Thu Sep 20, 2012 2:10 pm

Re: Sample do not run on Win 8

Post by john06 »

One more indication, Win8 Client and Win7 Server or vice versa fail also.

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Sample do not run on Win 8

Post by jarl »

Thanks for troubleshooting this. I'll get a Windows 8 environment set up, and have a closer look.

Logging support (RCF::enableLogging()) was added in build 2665.

You could try building with RCF_USE_BOOST_ASIO defined, that way RCF will use the Boost.Asio library from your Boost version, rather than the somewhat older version of Asio that is included in RCF.
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

john06
Posts: 11
Joined: Thu Sep 20, 2012 2:10 pm

Re: Sample do not run on Win 8

Post by john06 »

Thanks for your suggestion,
I have builded the "RCF-2.0.0.2667 Demo" with RCF_USE_BOOST_ASIO defined (which implies linking with libboost_system-vc110-mt-sgd-1_51.lib), the issue persists :-(
I have sent by mail log files.

jarl
Posts: 238
Joined: Mon Oct 03, 2011 4:53 am
Contact:

Re: Sample do not run on Win 8

Post by jarl »

I've had a closer look at this now, and I'm pretty sure it boils down to the issue reported here:

http://stackoverflow.com/questions/1204 ... ch-origina

In Server.cpp, if you comment out the std::cin.get() and replace it with e.g.

while (true) Sleep(1000);

, then the server runs fine and the client can make calls to it.

What's happened is that when RcfServer::start() is called, it ends up making an asynchronous connect call (AcceptEx()) on a socket. Once the thread returns from RcfServer::start(), it then goes straight into the std::cin.get() call, which blocks on I/O. As the Stack Overflow link details, when a thread is blocked on I/O, the asynchronous requests it has made can't be completed, hence the server can't accept the call from the client and the client times out.

This is a rather amazing bug in Windows 8, and I would have to assume Microsoft will fix it fairly quickly. I will have to come up with a workaround for RCF (on Windows 8 and Server 2012), to make sure the asynchronous accept only happens on RCF server threads, but for now you'll need to make sure that the thread that calls RcfServer::start(), doesn't subsequently block on any I/O...
Kind Regards

Jarl Lindrud
Delta V Software
http://www.deltavsoft.com

john06
Posts: 11
Joined: Thu Sep 20, 2012 2:10 pm

Re: Sample do not run on Win 8

Post by john06 »

So I had definitely not any chance of founding the bug as I was focused on your code ;-)
Thanks a lot jarl !

Post Reply