[Ace-users] Question: Is it possible that getq thread would not be
called?
rachel_saf at yahoo.com
rachel_saf at yahoo.com
Wed Aug 15 06:14:40 CDT 2007
To: ace-bugs at cs.wustl.edu
Subject: Question: Is it possible that getq thread would not be
called?
ACE VERSION: 5.21
HOST MACHINE and OPERATING SYSTEM:
OS - SunOs 5.8 Generic_108528-09, machine - sparc SUNW,Sun-
Blade-100
TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
OS - SunOs 5.8 Generic_108528-09, machine - sparc SUNW,Sun-
Blade-100/150
COMPILER NAME AND VERSION (AND PATCHLEVEL):
CC.6.2
THE $ACE_ROOT/ace/config.h
----------------------------------------------------------------
/* -*- C++ -*- */
// config-sunos5.8.h,v 4.3 2001/07/24 21:58:43 joeh Exp
// The following configuration file is designed to work for SunOS 5.8
// (Solaris 8) platforms using the SunC++ 4.x, 5.x, 6.x, or g++
compilers.
#ifndef ACE_CONFIG_H
// ACE_CONFIG_H is defined by one of the following #included headers.
// #include the SunOS 5.7 config, then add any SunOS 5.8 updates
below.
#include "ace/config-sunos5.7.h"
// The range of thread priorities for 5.8 differs from 5.7 in the
// minimum priority for the SCHED_OTHER policy (i.e.,
// ACE_THR_PRI_OTHER_MIN)
# define ACE_THR_PRI_OTHER_MIN (long) -20
fin
# if defined (_POSIX_PTHREAD_SEMANTICS)
# ifdef ACE_LACKS_RWLOCK_T
# undef ACE_LACKS_RWLOCK_T
# endif /* ACE_LACKS_RWLOCK_T */
# endif /* _POSIX_PTHREAD_SEMANTICS */
#endif /* ACE_CONFIG_H */
-----------------------------------------------------------------------------------
THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
use a link to a platform-specific file, simply state which one
I don't have this file
CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/
default.features
(used by MPC when you generate your own makefiles):
I don't have this file
DOES THE PROBLEM AFFECT:
COMPILATION? NO
LINKING? NO
On Unix systems, did you run make realclean first?
EXECUTION? YES. Only my application is affected.
SYNOPSIS: It seems that no messages are extracted from the queue
(the getq thread is not called)
DESCRIPTION:
My application uses ACE to maintain a queue of tcp messages to
process.
We have a very rare phenomenon that at certain time during the
execution no messages are extracted from the
queue. So no messages are processed.
Is it possible that from some reason the thread that extracts the
messages isn't called anynmore?
I quote here the code of insertion and extraction from the queue:
Insertion:
----------
int TCP_Client_Handler::svc(void)
{
// Forever...
while( 1 )
{
if (this->process() == -1)
return -1;
}
return 0;
}
int TCP_Client_Handler::process ()
{
// read the data from the stream from client
if (readFromClient () == -1) {
//m_trace.Trace (DBG_BASIC_LEVEL, "ERROR in data reading from
client.\n");
return -1;
}
try {
Unit_Of_Work *pWork = 0L;
do {
pWork = 0L;
m_buffer.storePosition();
// parse the input, create a Work unit and ...
pWork = m_requestProcessor->parseAndCreateWork (m_buffer);
if (pWork) {
std::auto_ptr<Unit_Of_Work> work_ptr (pWork);
if (m_task) {
if (m_task->getThreadsNumber() != m_threads_per_connection) {
m_trace.Trace (DBG_BASIC_LEVEL, "ERROR. threads' number in the
pool has been degraded.\n");
return -1;
}
Message_Block *message = new Message_Block (work_ptr.release ());
// ... add that into the thread pool to execute.
if (m_task->putq (message) == -1) {
delete message;
m_trace.Trace (DBG_BASIC_LEVEL, "ERROR in adding the UnitOfWork
into the queue.\n");
return -1;
}
} else {
if (work_ptr->process () == -1) {
m_trace.Trace (DBG_BASIC_LEVEL, "ERROR in the UnitOfWork
processing.\n");
return -1;
}
}
} else { // pWork wasn't created
m_buffer.returnToStored ();
}
} while (pWork);
} catch (const ProtocolException) {
m_trace.Trace (DBG_BASIC_LEVEL, "ERROR. Protocol Exception.\n");
return -1;
} catch (const AdapterException ex) {
m_trace.Trace (DBG_BASIC_LEVEL, ex.getMessage ().c_str ());
return -1;
} catch (...) {
m_trace.Trace (DBG_BASIC_LEVEL, "Unrecognized Exception was
thrown.");
return -1;
}
return 0;
}
Extraction:
------------
int Task::svc (void)
{
// Wait for all threads to get this far before continuing.
// this->m_barrier->wait ();
//m_trace.Trace (DBG_DETAILED_LEVEL, "Task %d starts in thread %u
\n", (void *) this, ACE_Thread::self ());
ACE_Message_Block *message;
Message_Block *message_block;
Data_Block *data_block;
Unit_Of_Work *work;
while (1)
{
// Get the ACE_Message_Block
if (this->getq (message) == -1)
{
//m_trace.Trace (DBG_BASIC_LEVEL, "UnitOfWork retrieving failed.
\n");
return -1;
}
message_block = (Message_Block *) message;
data_block = (Data_Block *) (message_block->data_block ());
work = data_block->data ();
if (message_block->msg_type () == ACE_Message_Block::MB_HANGUP)
{
//m_trace.Trace (DBG_BASIC_LEVEL, "Task is shutting down.\n");
if (this->putq (message_block->duplicate ()) == -1)
{
m_trace.Trace (DBG_BASIC_LEVEL, "Work queue closing error.\n");
return -1;
}
message_block->release ();
break;
}
work = data_block->data ();
try
{
if (work->process () == -1)
{
this->close ();
}
}
catch (...)
{
m_trace.Trace (DBG_BASIC_LEVEL, "An exception occured during
request precessing\n");
this->close ();
}
message_block->release ();
}
return (0);
}
REPEAT BY:
We did not succeed to reproduce the problem. It happens after long
execution of the application.
SAMPLE FIX/WORKAROUND:
Only kill the application and restart it fix the problem.
More information about the Ace-users
mailing list