Subject: Re: Thread safety issues

Re: Thread safety issues

From: Daniel Stenberg <>
Date: Thu, 26 Aug 2010 23:45:06 +0200 (CEST)

On Thu, 26 Aug 2010, jmk wrote:

> I maintain a password auditing utility[1] and have been using libssh2 with
> it for a while. Unfortunately, I seem to encounter thread safety issues from
> time to time within the library. For example, if compiled with libgcrypt,
> multi-threaded uses of the library consistently result in a segfault.
> Everything appeared to behave as expected using libssh2 compiled with
> openssl support up through version 1.2.6. Starting with 1.2.7,
> multi-threaded uses result in segfaults (double frees) such as:

Both libgcrypt and OpenSSL have mutex functions that are supposed to be used
when handled multi-threaded. Do you use them?

> I'm at a loss for where to start debugging this.

If you're convinced this works with 1.2.6 and not 1.2.7, it could be an idea
to bisect your way to the exact change that introduced this problem in the
code. "git help bisect" !

Received on 2010-08-26