[ace-users] Question: Is it possible that getq thread would not be called?

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Wed Aug 15 13:33:16 CDT 2007


Hi,

Thanks for using the PRF.

>    ACE VERSION: 5.21

Please upgrade to ACE+TAO+CIAO x.5.10 (i.e., ACE 5.5.10, TAO 1.5.10, and
CIAO 0.5.10), which you can download from

http://download.dre.vanderbilt.edu

under the heading: "Latest Beta Kit".

The DOC groups at Washington University, UC Irvine, and Vanderbilt
University only provide "best effort" support for non-sponsors for the
latest release, as described in

http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/docs/ACE-bug-process.html

Thus, if you need more "predictable" help for earlier versions of
ACE+TAO, I recommend that you check out

http://www.dre.vanderbilt.edu/support.html

for a list of companies that will provide you with ACE+TAO commercial
support.

Thanks,

        Doug

>    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.
>


-- 
Dr. Douglas C. Schmidt                       Professor and Associate Chair
Electrical Engineering and Computer Science  TEL: (615) 343-8197
Vanderbilt University                        WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203                          NET: d.schmidt at vanderbilt.edu



More information about the Ace-users mailing list