Segfault in TTree::Fill w/threads

Hello again,
My group recent got a new Linux server for our analysis and I’ve been porting my code from Windows onto it. However, I’ve come across an unusual segfault when running my analysis with multiple threads. The problem seems to be coming from a call to TTree::Fill(), but only when I’m running multiple threads. Running the program with 4 threads in a debug build of root generates the output in stacktrace.txt. The problem goes away when I use a single thread (single_thread.txt). This machine runs CentOS 6.2 x64 and has GCC 4.4.6 and root 5.32/02. My code works just fine running on Win 7 x64 with VC++9.0 and 5.32/00.
My code is attached in code.tar.gz along with the scripts to build it. Since I need the Boost library to read very large files on Windows, I use Boost.Build to compile it. The file user-config.jam must be in the home directory with the paths to the root libraries properly configured. Once that is done, just run “./ debug”.
code.tar.gz (105 KB)
single_thread.txt (732 Bytes)
stacktrace.txt (7.66 KB)


With the current version of ROOT, you must make sure that only one thread access the same TFile and TTree object at a time. In addition, the meta data build (TClass, TStreamerInfo) is not yet thread safe and need to be done serialized. This usually can be achieved by insuring that the first call to TTree::Fill (for each TTree) and the first call to TTree::Write (for any TTree) are ‘locked’.