[ROOT] problems with TThreads under RedHat 7.x

From: Robert Feuerbach (feuerbac@jlab.org)
Date: Wed Jul 02 2003 - 18:29:54 MEST


Dear ROOT-team,

We're experimenting with using threads to help with an event
display, but are having difficulty getting even the standard
examples ( Mhs3 is one ) to work under RedHat 7.x, and are 
looking for a solution.

An extremely simple example is given below, and works fine on our
older RedHat 6.2 machines (single and multi-processor). Both the
7.x and 6.2 machines use the same version of ROOT 3.05-04 ,
though separately compiled libraries.

There had been some previous discussions about TThreads under 
Redhat 7.x, with the conclusion that a version of glibc>=2.2.5-37  
(on RH 7.2) was necessary, which our glibc is.

When the simple script crashes, it appears to be hung up in a 
TThread::Printf:
(excerpts from the stack trace)
 0x40dd7f05 in <unknown> from /lib/i686/libpthread.so.0
 0x42029188 in <unknown> from /opt/root-rh7-g++/new/bin/root.exe
 0x40dd7609 in <unknown> from /lib/i686/libpthread.so.0
 0x40dd3eec in pthread_cond_wait + 0x118 from /lib/i686/libpthread.so.0
 0x41495911 in TPosixCondition::Wait(void) + 0x29 from /opt/root-rh7-g++/new/lib/libThread.so
 0x41498a5c in TThread::XARequest(char const *, int, void **, int *) + 0x114 from /opt/root-rh7-g++/new/lib/libThread.so
 0x41498920 in TThread::Printf(char const *, long) + 0x34 from /opt/root-rh7-g++/new/lib/libThread.so
 0x41498566 in TThread::Fun(void *) + 0x7e from /opt/root-rh7-g++/new/lib/libThread.so

Any ideas? Are other people seeing this problem? 

Thanks for you help,
Rob

----------------
Configurations for "Broken" Threads:
  Linux 2.4.20-18.7smp #1 SMP Thu May 29 07:49:23 EDT 2003 i686 unknown
AND
  Linux 2.4.18-10 #1 Wed Aug 7 10:26:48 EDT 2002 i686 unknown

  ROOT version 3.05-04
  gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
  glibc-2.2.5-43
-----------------

Simple Test script (loaded with .L test2.C++):

//-------- test2.C --------------------------------
#include "TThread.h"

void *th1(void *ptr)
{
  TThread::Printf("Start of thread 1 %x \n",ptr);
  // sleep for a little while
  gSystem->Sleep(5000);
  TThread::Printf("Thread 1 finished\n");
  return NULL;
}

void *th2(void *ptr)
{
  TThread::Printf("Start of thread 2 %x \n",ptr);
  // sleep for a little while
  gSystem->Sleep(2000);
  TThread::Printf("Thread 2 finished\n");
  return NULL;
}
    
void test_threads() {
  TThread *t1 = new TThread(th1,0);
  TThread *t2 = new TThread(th2,0);
  t1->Run();
  t2->Run();
  return;
}
// END test2.C --------------------------------


-- 
/***************************************************
 * Robert Feuerbach              feuerbac@jlab.org *
 * Jefferson Lab                CEBAF Center  A120 *
 * 12000 Jefferson Avenue   Office: (757) 269-7254 *
 * Mail Stop 12H              Page:       584-7254 *
 * Newport News, VA 23606      Fax: (757) 269-5703 *
 ***************************************************/



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET