Uploaded image for project: 'Fabric'
  1. Fabric
  2. FAB-18472

unit tests hang when running pkcs11 test with Softhsm 2.6.1



    • Bug
    • Status: Unverified
    • Low
    • Resolution: Unresolved
    • v2.x
    • v2.x
    • fabric-crypto
    • None
    • Hide
      make unit-test
      with pkcs11 enabled for softhsm 2.6.1 on linux
      make unit-test with pkcs11 enabled for softhsm 2.6.1 on linux


      The hang is due to the race detector being used when os.Exit(0) is called. In Go os.Exit(0) waits for the race detector to complete. If the tests are run without the race detector then the problem doesn't occur. As the builds that run the unit tests don't hang it's likely this is something introduced with newer versions of softhsm as the builds use the version shipped by the repo of the distro being used.

      One possibility of the problem is that fabric never bothers to unload the softhsm library (ie never calls Destroy on the pkcs11 3rd party library) but to add that code so that the unit tests can properly clean up is a much larger undertaking and currently is not code that would be called by fabric, however I believe this is an item for graceful shutdown which may make sense for it to clean up pkcs11 resources before terminating.

      The easiest solution at this time is just to call syscall.Exit which bypasses the wait for the race detector to finish. 







            davidkel Dave Kelsey
            davidkel Dave Kelsey
            0 Vote for this issue
            1 Start watching this issue