I had written a multi-threaded application in C++, which was using libcurl and GnuTLS for making https post requests to a webservice call. Now, when I was making individual requests, it was working fine and faster than an equivalent Ruby program. When I did a load test of 300 requests per milli second, it crashed with the following error:
ath.c:184: _gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed. Aborted!!
From the assertion, it seemed to be an issue with variables not being initialized. Digging more, I found people suggesting to use libgcrypt > 1.2, which was stable and has fixed this error. Well, I was not sure, that GnuTLS was using it and neither did I know that, a multi-threaded application will have to make some `init' calls before using the library calls.
Now, I found this link, which looked to me like the solution. But, it didn't look convincing. My idea was, if a library uses another library, it should do all these initialization tasks, rather than expecting the application to do it. :)
Well, I changed from GnuTLS to OpenSSL and, my load test seemed to work, without crashing the application.
Now, I am not sure, where will I end up, if I start exploring `GnuTLS versus OpenSSL`. That is not my current priority.