SDE: Problem when using shutdown for multiple libs

Issue #133 resolved
Terry Cojean created an issue

Maybe I am misusing the sde in which case I will change how we use it in our code.

Context:

In our code (Ginkgo), we consider that every new logger object the user instantiates should be a separate namespace/library, because that would mean the user wants to count different things or in a different way (otherwise, they could just use one logger for everything). For most users, there would be only one logger object and thus only one sde:::ginkgo namespace. We differentiate namespaces by adding an extra unique number to it.

Problem:

In the case where there are multiple logger objects, thus multiple library namespaces registered under the sde, then we need to calling multiple times papi_sde_init and papi_sde_shutdown (at the construction/destruction of the Ginkgo logger, essentially). In this precise case, I found that the global control structure is not kept consistent: the lib_handle is freed but the global control structure still points to the freed objects, this makes any subsequent call to any sde function fail after calling papi_sde_shutdown once.

Fix:

For more details, see the following commit which fixes the problem. It’s most likely not entirely correct, but it makes our use case (examples and tests) pass: https://bitbucket.org/terry_cojean/papi/commits/77cdd0ba8db98d86c1459dd5f55013aba242d5d5

Comments (8)

  1. Anthony Danalis

    Terry, your solution seems good to me. Can you post it as a PR to our repo?

    thanks,

    Anthony

  2. Terry Cojean Account Deactivated reporter

    It seems I do not have the right to open a PR. I would be happy to afterwards. Otherwise, feel free to steal this small commit that’s fine with me as well.

  3. Terry Cojean Account Deactivated reporter

    Thanks Anthony, I misunderstood how Bitbucket works, the link was helpful!

  4. Log in to comment