"X strings remain in the string pool" failing tests

Bug #866932 reported by Gabriel Petrovay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
Medium
Markos Zaharioudakis

Bug Description

There have been a number of bug reports over the years where Zorba crashes on exit with a message like the following:

i = 94 String http://www.zorba-xquery.com/options/versioning is still in the pool
Zorba Internal Fatal Error in home/ceej/zo/src/src/store/naive/string_pool.cpp:42:
"count == 0": condition failed: 1 strings remain in the string pool

As far as I know, we have never completely figured out what causes these errors nor how to correct them.

Gabriel initially reported this bug 866932 listing several test cases which exhibited this symptom, but those were subsequently cleared up by some other change without fixing the underlying problem.

I have just now found at least one reliable way to reproduce this result (see comment #3), so I have co-opted this bug report.

Tags: core-runtime
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

can you please double check if the problem still exists?

Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

It works!

Good policy! Wait so long until the problem is hidden and does not show up anymore.

(The underlying problem is still there "string remaining in the string pool". It but it does not show up in this case but it shows up in many cases when I shut down Zorba).

I guess this would have been a good chance to track the problem down. But I guess this is too late now.

Chris Hillery (ceejatec)
Changed in zorba:
assignee: Matthias Brantner (matthias-brantner) → Markos Zaharioudakis (markos-za)
Revision history for this message
Chris Hillery (ceejatec) wrote :

I have finally come up with a test case that reliably reproduces this problem. It occurs when you create a QNameItem using ItemFactory and pass a global zstring constant as the namespace URI. From stepping through with the debugger, it seems QNamePool puts the namespace URI zstrings into a StringPool, and ~StringPool doesn't like finding a zstring in there who is still marked as "shared" (which I think actually means "still has outstanding references"). Since the zstring is a global, it still has a reference outstanding at the time the store is shut down and ~StringPool is called.

I have added a unit test case which demonstrates this scenario, along with a slight variant that does not trigger the problem (if you create a new zstring wrapped around GLOBAL_ZSTRING.c_str(), it works fine). This is checked in on the branch lp:~zorba-coders/zorba/strings-in-pool. On this branch, test/libunit/qname_pool_global fails with this error, but test/libunit/qname_pool_local passes. (I have marked qname_pool_global as EXPECTED_FAILURE(), but since the test actually dies with an ABORT signal due to the assert, it still fails locally. It will pass on the validation queue, which does some post-processing for such cases.)

I can't swear this is the *only* cause of this problem, of course, but it is at least one, and one that specifically is biting me at the moment.

Given that this error is only occurring when the store is shutting down (and hence presumably the process is about to end anyway), perhaps a quick and dirty solution would be to simply eliminate the assert()? Is this really catching any errors that are serious enough to abort the program?

Chris Hillery (ceejatec)
description: updated
Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

I have changed the global zstrings in staitc_context to const char* strings.

Changed in zorba:
status: New → Fix Committed
Changed in zorba:
milestone: none → 2.2
Changed in zorba:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.