[omniORB] Lockup on Solaris 2.5.1 with Y2K patch

Sai-Lai Lo S.Lo@uk.research.att.com
21 Jun 1999 23:57:42 +0100


The problem seems to occur only on one machine at our site. I'm able to
produce a lockup with this simple test:

The problematic machine is a dual processor ultra 2. I've tested the same
program on a 14-processor, a 4-processor, and various uniprocessor solaris
machines. Only one machine has this problem. So the problem may just be
a special combination of patches. In any case, it is worth checking if this
is causing problem with your machines.

Sai-Lai

------------------- cut here  -------------------------------------------
// $ CC -o thr thr.cc -mt -lposix4
// $ while [ 1 ]; do ./thr; done
#include <pthread.h>
#include <iostream.h>
#include <time.h>

pthread_cond_t  cond;
pthread_mutex_t mutex;
pthread_t       thr;
int             died = 0;

extern "C" 
void*
worker(void* ptr)
{
  while (!died) {
    struct timespec abs;
    clock_gettime(CLOCK_REALTIME,&abs);
    abs.tv_sec += 1;
    pthread_mutex_lock(&mutex);
    pthread_cond_timedwait(&cond,&mutex,&abs);
    pthread_mutex_unlock(&mutex);
  }
  cerr << "worker exit" << endl;
  pthread_exit(0);
  return 0;
}

class killer {
public:
  ~killer() {
    void** status = 0;
    pthread_mutex_lock(&mutex);
    died = 1;
    pthread_mutex_unlock(&mutex);
    pthread_join(thr,status);
    cerr << "killer done." << endl;
  }
  static killer theInstance;
};

killer killer::theInstance;



int
main(int,char**)
{
  pthread_cond_init(&cond,0);
  pthread_mutex_init(&mutex,0);
  
  pthread_attr_t attr;

  pthread_attr_init(&attr);

  pthread_create(&thr,&attr,worker,0);
  return 0;
}
--------------------------------------------------------------------



-- 
Sai-Lai Lo                                   S.Lo@uk.research.att.com
AT&T Laboratories Cambridge           WWW:   http://www.uk.research.att.com 
24a Trumpington Street                Tel:   +44 1223 343000
Cambridge CB2 1QA                     Fax:   +44 1223 313542
ENGLAND