bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Threads trouble


From: Borja Pacheco
Subject: Threads trouble
Date: Wed, 03 Dec 2003 10:17:47 +0100

Dear all,

I've made an applicaction using your Thread and TCP stream and socket classes. All seemed to works fine, but one made the put on production, the program deads after 2 hours. An exception is catched, but no one line of this code can produce any exception (refering to CommonC++'s API reference), what could be going on?

The application tries to be (  :(  ), a multithreading server. This server acts in the following manner:
a) Create server sockets
b) Become waiting for new incoming connections.
c) Creates a new thread to serve de request
d) Starts the thred.

The code is the following one....


void AListeningThread::run() {

....

try {
serverSocket = new TCPSocket (*ip, portTCP);
}
catch(Socket *socket) {
    tpport_t port;
    InetAddress saddr = (InetAddress)socket->getPeer(&port);
    printf ("FATAL - an error message\n",getTime());
    if(socket->getErrorNumber() == Socket::errResourceFailure) {    
        logger->registraFallo("Another error Message");
    }
    if(socket->getErrorNumber() == Socket::errBindingFailed) {
            logger->registraFallo("Another error Message");
    }
}

try {
    while (serverSocket->isPendingConnection()) {
           service = new ServiceThread (serverSocket);
              service -> detach();
    }
}
catch (...) {
    logger->registraFallo("Unexpeted exception produced!!!");
}

}

As I told you, the unexpected exception is produced every two hours, and I don't have any idea of why (it's strange because I've implemented a watchdog using netcat and the cron, which request an ARE_YOU_ALIVE frame every two minutes, and these are always the ones which hang-off the server...)

Best Regards
reply via email to

[Prev in Thread] Current Thread [Next in Thread]