From dfe4c63e1944db5bbd5fe8a468fe7191f6fb08c3 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 18 Jun 2003 15:38:17 -0500 Subject: [svn-r7051] Purpose: Bug fix Description: When objects were left open in a file, the API shutdown code would end up closing property lists "out from underneath" files that were left open pending the objects in the being closed. This caused problems later when file objects would try to access their property list and fail to close, causing an infinite loop in the library shutdown. Solution: Create some dependencies in the order that APIs are shut down, trying to close "higher" level APIs before closing "low" level APIs. This still isn't precise, but it does work correctly now. Platforms tested: FreeBSD 4.8 (sleipnir) h5committest --- src/H5.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/H5.c b/src/H5.c index 95dfea9..e84aebf 100644 --- a/src/H5.c +++ b/src/H5.c @@ -213,20 +213,35 @@ H5_term_library(void) do { pending = 0; - pending += DOWN(F); - pending += DOWN(FD); + /* Try to organize these so the "higher" level components get shut + * down before "lower" level components that they might rely on. -QAK + */ + pending += DOWN(R); pending += DOWN(D); - pending += DOWN(Z); pending += DOWN(G); - pending += DOWN(FL); - pending += DOWN(R); + pending += DOWN(A); pending += DOWN(S); pending += DOWN(TN); pending += DOWN(T); - pending += DOWN(A); - pending += DOWN(AC); - pending += DOWN(P); - pending += DOWN(I); + /* Don't shut down the file code until objects in files are shut down */ + if(pending==0) + pending += DOWN(F); + + /* Don't shut down "low-level" components until "high-level" components + * have successfully shut down. This prevents property lists and IDs + * from being closed "out from underneath" of the high-level objects + * that depend on them. -QAK + */ + if(pending==0) { + pending += DOWN(AC); + pending += DOWN(Z); + pending += DOWN(FD); + pending += DOWN(P); + pending += DOWN(I); + /* Don't shut down the free list code until _everything_ else is down */ + if(pending==0) + pending += DOWN(FL); + } } while (pending && ntries++ < 100); if (pending) { -- cgit v0.12