Ubuntu server 12.04 crash
#7
Any chance you could modify the source a bit to add more logging, so that we know where exactly the problem happens?
I'm guessing it's somewhere in the cSocketThreads::cSocketThread::Execute() method. So replace that method (cSocketThreads.cpp, line ~500) with this code:
Code:
void cSocketThreads::cSocketThread::Execute(void)
{
    // Connect the "client" part of the Control socket:
    LOG("Execute() start");
    m_ControlSocket1 = cSocket::CreateSocket();
    cSocket::SockAddr_In Addr;
    Addr.Family = cSocket::ADDRESS_FAMILY_INTERNET;
    Addr.Address = cSocket::INTERNET_ADDRESS_LOCALHOST();
    Addr.Port = m_ControlSocket2.GetPort();
    ASSERT(Addr.Port != 0);  // We checked in the Start() method, but let's be sure
    if (m_ControlSocket1.Connect(Addr) != 0)
    {
        LOGERROR("Cannot connect Control sockets for a cSocketThread (\"%s\"); continuing, but the server may be unreachable from now on.", Socket::GetLastErrorString().c_str());
        m_ControlSocket2.CloseSocket();
        return;
    }
    LOG("ControlSockets connected");
    
    // The main thread loop:
    while (!m_ShouldTerminate)
    {
        // Put all sockets into the Read set:
        fd_set fdRead;
        cSocket::xSocket Highest = m_ControlSocket1.GetSocket();
        
        LOG("Preparing fdRead");
        PrepareSet(&fdRead, Highest);
        
        // Wait for the sockets:
        LOG("select()ing fdRead");
        if (select(Highest + 1, &fdRead, NULL, NULL, NULL) == -1)
        {
            LOG("select(R) call failed in cSocketThread: \"%s\"", cSocket::GetLastErrorString().c_str());
            continue;
        }
        
        LOG("Reading from sockets");
        ReadFromSockets(&fdRead);

        // Test sockets for writing:
        LOG("Preparing fdWrite");
        fd_set fdWrite;
        Highest = m_ControlSocket1.GetSocket();
        PrepareSet(&fdWrite, Highest);        
        timeval Timeout;
        Timeout.tv_sec = 0;
        Timeout.tv_usec = 0;
        LOG("Selecting fdWrite");
        if (select(Highest + 1, NULL, &fdWrite, NULL, &Timeout) == -1)
        {
            LOG("select(W) call failed in cSocketThread: \"%s\"", cSocket::GetLastErrorString().c_str());
            continue;
        }
        
        LOG("Writing to sockets");
        WriteToSockets(&fdWrite);
        
        LOG("Removing closed sockets");
        RemoveClosedSockets();
    }  // while (!mShouldTerminate)
}
This should provide a more detailed log, so paste it here.
Reply
Thanks given by:


Messages In This Thread
Ubuntu server 12.04 crash - by fodah - 06-12-2012, 11:55 AM
RE: Ubuntu server 12.04 crash - by xoft - 06-12-2012, 05:55 PM
RE: Ubuntu server 12.04 crash - by fodah - 06-13-2012, 02:53 AM
RE: Ubuntu server 12.04 crash - by cedeel - 06-12-2012, 10:27 PM
RE: Ubuntu server 12.04 crash - by FakeTruth - 06-13-2012, 03:11 AM
RE: Ubuntu server 12.04 crash - by fodah - 06-13-2012, 03:28 AM
RE: Ubuntu server 12.04 crash - by xoft - 06-16-2012, 05:39 PM
RE: Ubuntu server 12.04 crash - by xoft - 07-18-2012, 08:59 PM



Users browsing this thread: 1 Guest(s)