[Ace-users] Testing application with purify the ACE::mutex(in OS_NS_Thread.cpp, function:cond_signal ) is going to infinite loop...

bangalore Dimonds syed.shamsheers at gmail.com
Thu Nov 15 11:54:15 CST 2007


    ACE VERSION:  5.5
*********************************
    HOST MACHINE and OPERATING SYSTEM:
    Microsoft Windows XP Professional(Version 5.1.2600 Service Pack 2
Build 2600 )
    winsock.dll Version 3.10
    wsock32.dll Version	5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
*********************************
    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
    Linux
*********************************

     COMPILER NAME AND VERSION :
     Microsoft Visual  C++   7.1.3088 (.NET 2003 , .NET Frame work
1.1.4322)

      Purify Version : IBM Rational Purify Version 7.0.0.0 build :
7264

*********************************


    THE $ACE_ROOT/ace/config.h FILE
     #define ACE_HAS_STANDARD_CPP_LIBRARY 1
     #include "ace/config-win32.h"
*********************************

    THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE  - NA

********************************

    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/
default.features - NA

********************************

    AREA/CLASS/EXAMPLE AFFECTED:

 In   "ACE_wrappers\ace\OS_NS_Thread.cpp"

Line No : 1403

Code :

  ACE_OS::thread_mutex_lock (&cv->waiters_lock_);

  int have_waiters = cv->waiters_ > 0;
  ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);

  printf("exit from unlock\n");

  if (have_waiters != 0)
  {
	 return ACE_OS::sema_post (&cv->sema_);

  }
  else
    return 0; // No-op

********************************

    DOES THE PROBLEM AFFECT:
        COMPILATION?
        LINKING?
               EXECUTION?
        OTHER

 PROBLEM AFFECTS IN execution,  when run with purify in release mode
*******************************

    SYNOPSIS:  mutex is under Infinite number of loops . control is
not coming outof the function  ==> "ACE_OS::cond_signal (ACE_cond_t
*cv) " when testing with purify in release mode.

Purify Version : IBM Rational Purify Version 7.0.0.0 build :7264
***********************************************************************************************

    DESCRIPTION:
If i run our application in Debug mode(VC7.1)  WithOut purify Its
working fine

If i run our application in Release mode(VC7.1)  WithOut purify  Its
working fine

If i run our application in Debug mode(VC7.1)   with Purify Its
working fine

If i run our application in Release mode(VC7.1) with Purify then while
its connecting to
the sever , it goes to infinite loop & its not comming out of the
Connect API

When I Trace The Code(our library & ACE code ) , I come to Now problem
is in ACE

In   "(Version 5.5) ACE_wrappers\ace\OS_NS_Thread.cpp" file  , Control
is not coming out of the function   "ACE_OS::cond_signal (ACE_cond_t
*cv) " (Line No : 1403)

Code snippet of ACE:

 ACE_OS::thread_mutex_lock (&cv->waiters_lock_);

 cout<<"Enter Lock"<<endl;          // I add this Line

  int have_waiters = cv->waiters_ > 0;
  ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);

  cout<<"Exit UnLock"<<endl        // I add this Line;

  if (have_waiters != 0)
  {
          cout<<"Inside have_waiters "<<endl; // I add this Line
	 return ACE_OS::sema_post (&cv->sema_);

  }
  else
    return 0;


After adding 3 cout statement i build the ACE dll in release mode and
when i run our application With Purify in Release mode, then that 3
statements are continuously printing ( Control is not comming out of
"cond_signal"  function. even after 10 Hours!).


Purify Version : IBM Rational Purify Version 7.0.0.0 Build :7264


    SAMPLE FIX/WORKAROUND: In File OS_NS_Thread.cpp ( from line No
1403)



 ACE_OS::thread_mutex_lock (&cv->waiters_lock_);

 cout<<"Enter Lock"<<endl;                 // I add this Line

  int have_waiters = cv->waiters_ > 0;
  ACE_OS::thread_mutex_unlock (&cv->waiters_lock_);

  cout<<"Exit UnLock"<<endl                // I add this Line;

  if (have_waiters != 0)
  {
          cout<<"Inside have_waiters "<<endl;          // I add this
Line
          return ACE_OS::sema_post (&cv->sema_);

  }
  else
    return 0;


Output got when i  run our application in  VC7.1 in Release mode with
Purify7.0 is

Infinite number of the lines which i added to ACE file
OS_NS_Thread.cpp (as in above)


Output:

----------
connecting to the server //Its in our application

Enter Lock
Exit UnLock
Enter Lock
Exit UnLock
Inside have_waiters

Enter Lock
Exit UnLock
Enter Lock
Exit UnLock
Inside have_waiters

.....
....  Infinite Nuber of times get same lines , Not coming  back to our
application
********************************
Plz help me to Resolve this problem

For further information plz mail me to
syeds_y2k at yahoo.co.in
syedsma at huawei.com

Thanks & Regards
Syed Shamsheer




More information about the Ace-users mailing list