[Debtags-devel] Any Idea why this fails?

Enrico Zini zinie@cs.unibo.it
Mon, 13 Sep 2004 17:13:57 +0200


--LQksG6bCIzRHxTLp
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline

On Sun, Sep 12, 2004 at 06:21:08PM +0200, Benjamin Mesing wrote:

> the code below fails when run multiple times (but not allways but only
> under special circumstences). I do not understand it and it seems to

Uhm... multiple times as in:
  while (1)
  {
         Tagcoll::InputMerger<int, string> merger;
         Tagcoll::TagcollBuilder collBuilder(*(new Tagcoll::HandleMaker<string>()));
         // load the database into the collBuilder and change it to handles
         Debtags::TagDB::outputSystem(collBuilder, false);
  }
or multiple times as in:
  while (1)
  {
    exec in new thread {
         Tagcoll::InputMerger<int, string> merger;
         Tagcoll::TagcollBuilder collBuilder(*(new Tagcoll::HandleMaker<string>()));
         // load the database into the collBuilder and change it to handles
         Debtags::TagDB::outputSystem(collBuilder, false);
    }
  }
?


Design note: now that we have autodebtag I was considering moving
expansion of derived tags into autodebtag, and just loading the system
database "as is".  This would really help efficiency: for example, you
could mmap the file, or add an index pointing to where the tags for a
given package are in the text file.  Plus, you relieve from the client
applications the burden or recomputing the full tagsets every time.

The bug you report happens in such computation.  Once I make this move,
it should go away.  If it happens in the first of the cases above, it is
a bug in the library and should be hunted down anyway.  If it happens in
the threaded case, however, it may be a race condition as the library
has never been checked for thread-safety.

This all points out the need for some test cases.  I would really
appreciate someone with more experience on writing automated tests to
contribute a bit.


Ciao,

Enrico

--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico@debian.org>

--LQksG6bCIzRHxTLp
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBRbk09LSwzHl+v6sRAu6wAJsGBCfCL68CuZEz9hwCr3fY4yPVYACcD+5k
eZwHtpguQNWvY7zom+tRXaM=
=njvS
-----END PGP SIGNATURE-----

--LQksG6bCIzRHxTLp--