Hello,
I am facing a strange problem when I am starting the XmlRpcServer using threads.
Let me explain the scenario
Since XmlRpcServer::work() method is blocking call, I didn't want to block my process I called work() in a thread.
After starting the server like this and if I try to send a request from the client I am getting error 13.
code snippet:
startThread( )
{
m_serverNodeThread = factory->createThread(this);
m_serverNodeThread->start();
m_serverNodeThread->join();
}
execute( )
{
m_server->work(-1.0);
}
execute() is a pure virtual method implemented in this class, which will be called as a result of "m_serverNodeThread->start();"
Traces given by the library are as follows:
XmlRpcServer::work: waiting for a connection
XmlRpcServer::acceptConnection: socket 5
XmlRpcServer::acceptConnection: creating a connection
XmlRpcServerConnection: new socket 5.
XmlRpcSocket::nbRead: read/recv returned 140.
XmlRpcSocket::nbRead: read/recv returned -1.
XmlRpcServerConnection::readHeader: error while reading header (error 13).
XmlRpcSource::close: closing socket 5.
XmlRpcSocket::close: fd 5.
XmlRpcSource::close: done closing socket 5.
XmlRpcSource::close: deleting this
XmlRpcServerConnection dtor.
Traces given by the library in normal scenario (without threads) are as follows:
XmlRpcServer::work: waiting for a connection
XmlRpcServer::acceptConnection: socket 5
XmlRpcServer::acceptConnection: creating a connection
XmlRpcServerConnection: new socket 5.
XmlRpcSocket::nbRead: read/recv returned 140.
XmlRpcSocket::nbRead: read/recv returned -1.
XmlRpcServerConnection::readHeader: read 140 bytes.
XmlRpcSocket::nbRead: read/recv returned 397.
XmlRpcSocket::nbRead: read/recv returned -1.
XmlRpcServerConnection::readHeader: read 537 bytes.
XmlRpcServerConnection::readHeader: specified content length is 397.
KeepAlive: 0
XmlRpcServerConnection::readRequest read 397 bytes.
XmlRpcServerConnection::executeRequest: server calling method 'UserRequest'
I searched for error: 13, it says permission denied.
Is there anything wrong in the way I starting the server ?
Can any one throw some light on this?
I found this behavior only on Solaris .
It executes perfectly as expected on Linux.
In XmlRpcSocket.cpp file there is a function "nonFatalError()" and inside this function you are returning true for "EINPROGRESS, EAGAIN, EWOULDBLOCK, EINTR. if we add EACCESS(13) then things are working as expected.
code would look like this :
static inline bool
nonFatalError()
{
return (err == EINPROGRESS || err == EAGAIN || err == EWOULDBLOCK || err == EINTR || err == 13);
}
Can you please tell whether this is a valid change ?
Thanks