Looking at the stacktrace top when we crash on 'import gnutls.crypto':
#0 __pthread_mutex_lock (mutex=0x7ffff56f32c4) at pthread_mutex_lock.c:50
#1 0x00007ffff4f6c7bd in mutex_init (lock=0x7ffff520e228, just_check=1) at ath.c:132
#2 0x00007ffff4f6c91d in _gcry_ath_mutex_lock (lock=0x7ffff520e228) at ath.c:186
#3 0x00007ffff4f69b2d in _gcry_secmem_get_flags () at secmem.c:443
#4 0x00007ffff4f633e0 in _gcry_vcontrol (cmd=GCRYCTL_SUSPEND_SECMEM_WARN, arg_ptr=0x7ffffffef158) at global.c:378
#5 0x00007ffff4f600cd in gcry_control (cmd=GCRYCTL_SUSPEND_SECMEM_WARN) at visibility.c:78
We are crashing in gnutls/library/__init__.py. Because of bug 423252, global_init() for libgcrypt is not being called on GCRYCTL_SET_THREAD_CBS anymore, so when GCRYCTL_SUSPEND_SECMEM_WARN is called, it tries to acquire the mutex, which has never been initialized.
As suggested in the comments for global_init(), adding: libgnutls.gcry_check_version(None) just before the call to GCRYCTL_SUSPEND_SECMEM_WARN will force a call to global_init(), and there isn't a crash on 'import gnutls.crypto'.
Looking at the stacktrace top when we crash on 'import gnutls.crypto':
#0 __pthread_ mutex_lock (mutex= 0x7ffff56f32c4) at pthread_ mutex_lock. c:50 0e228, just_check=1) at ath.c:132 mutex_lock (lock=0x7ffff52 0e228) at ath.c:186 get_flags () at secmem.c:443 SUSPEND_ SECMEM_ WARN, arg_ptr= 0x7ffffffef158) at global.c:378 SUSPEND_ SECMEM_ WARN) at visibility.c:78
#1 0x00007ffff4f6c7bd in mutex_init (lock=0x7ffff52
#2 0x00007ffff4f6c91d in _gcry_ath_
#3 0x00007ffff4f69b2d in _gcry_secmem_
#4 0x00007ffff4f633e0 in _gcry_vcontrol (cmd=GCRYCTL_
#5 0x00007ffff4f600cd in gcry_control (cmd=GCRYCTL_
We are crashing in gnutls/ library/ __init_ _.py. Because of bug 423252, global_init() for libgcrypt is not being called on GCRYCTL_ SET_THREAD_ CBS anymore, so when GCRYCTL_ SUSPEND_ SECMEM_ WARN is called, it tries to acquire the mutex, which has never been initialized.
As suggested in the comments for global_init(), adding: libgnutls. gcry_check_ version( None) just before the call to GCRYCTL_ SUSPEND_ SECMEM_ WARN will force a call to global_init(), and there isn't a crash on 'import gnutls.crypto'.