Menu

#35 error no:13 when calling work() in a thread

open
9
2011-02-04
2011-02-04
nechandra
No

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.

Discussion

  • nechandra

    nechandra - 2011-02-04
    • priority: 5 --> 9
     
  • nechandra

    nechandra - 2011-02-04

    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

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.