c++ – vmime, libgnutls, and libgcrypt problem? Assertion failed! – Education Career Blog

I am developing an application in C++ to check the users email accounts. This application uses the vmime library to do the processing related to POP3/IMAP/SMTP protocols.

I designed the application to work continuously. So, it has to be stable enough!

Sometimes, the application suddenly stops giving this strange error:

ath.c:193: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed.
Aborted

I know that vmime uses libgnutls and this one uses libgcrypt.

Can anybody help in solving this error?

For more info, the application is multi-threaded. I am using vmime-0.9.0, libgcrypt-1.4.4, and libgnutls-2.8.5.

Thanks very much,

,

It seems that vmime has a bug related to the use of gnutls in the case of multi-threaded application.
I did what the documentation of gnutls says in the following page:

http://www.gnu.org/software/gnutls/manual/gnutls.html#Multi_002dthreaded-applications

I just the added the line:

gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);

before the line:

gnutls_global_init();

in the file:

net_tls_TLSSession.cpp

and rebuilt vmime.
Of course, I included the needed header files showed in the documentation example.

Leave a Comment