It takes for ever to close a ROOT file

Dear Sir/Madam,

I am experencing that ROOT file is not cllosed correctly when program run on a batch system at CERN. Then I run my program llocally and found that it takes looong time to close the root file (I have to kill the process) which produced by the program. I think because of this, the batch system kill my jobs. Now I am wondering why the root file can’t be closed.

Thank you for your kind help.

Best regards,
Zhongbao

Please send the shortest possible RUNNING script reproducing this problem. Don’t forget to mention the root version

Rene

Dear Rene,

I am not sure I can re-produce the problem when I shorten the program so I send you the
whole package I used, compile it with Makefile. The root version I use as in the afs is
5.12/00

See next e-mail, where program can re-produce the problem.

Dear Rene,

please find attached package. You can compile it with Makefile. To produce the problem,
run ./phosMonitoring 2006run3959.raw

Thank you for your kind help.

Best regards,
Zhongbao

In your class TPHOSMonitor, you call the function BookHistogram twice,
creating twice the same file with the same histograms !

Rene

Dear Rene,

thank you very much. Then that’s something related to data acquisition system—DATE,
that’s strange there are two start of run events in one single run.

Thank you very much for your kind help.

Best regards,
Zhongbao

Dear Rene,

it looks like there are something else caused the problem since after I modified the
code the problem remains.

bool histoBooked = false;

if(!histoBooked) {
BookingHistograms(fRunNumber);
histoBooked = TRUE;
printf(“Histograms are booked!\n”);
}

could you help me out? Thanks a lot…

Best regards,
Zhongbao

OK, I understand the problem now. Your directory contains more than
100,000 histograms. I have improved the situation in the CVS version
when closing a directory with a huge number of objects and when
this directory does not contain other subdirs.

In your case, you can simply bypass the problem by callng

fOutputFile->GetList()->Clear(); just before

fOutputFile->Close(); in your function TPHOSMonitor::Close

Rene

Dear Rene,

thanks. That solves the problem.

Best regards,
Zhongbao