Comment 3 for bug 1014309

Revision history for this message
Jason Conti (jconti) wrote :

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'.