-
Notifications
You must be signed in to change notification settings - Fork 542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi-threaded "libssh2_init()" #61
Comments
It is not that easy to "just add" such a flag unless we also make assumptions of what thread system/model your application is using. That's why it is documented to not be thread-safe so you have to do the mutexing yourself. |
Thanks a lot for your answer. My problem is, that I can't initialize
|
libssh2 should init the crypto lib when you call libssh2_init(). Doesn't it? You just need to make sure that libssh2_init() isn't called in a thread-unsafe way, |
Sorry - my description was a mess.
My idea was to add a flag to |
Maybe: Our application is threaded - and we are getting core dumps only if multiple threads are calling
|
The great Daniel Stenberg :-) wrote some examples on this topic: My problem: IHMO the best option would be: |
Hi, Anyway my application crashes when opening an SFTP connection. In detail, libssh2_session_handshake crashes while invoking HMAC_Init_ex, EVP_DigestInit_ex, CRYPTO_free: I guess there's problem in the setup of my environment. Any idea? |
Problem fixed! I fixed the problem by installing a newer version of libssh2. I came across this: http://trac.libssh2.org/ticket/279 The problem was initially fixed in the 1.5.0, then completely fixed the 1.6.0 version (see the change log https://www.libssh2.org/changes.html) @doublex I guess that it's not possible to add such a LIBSSH2_INIT_MULTITHREADED flag for the libssh2_init function because libssh2 users are free to use different crypto libraries that in turn require different initializations. But this is just my understanding as libssh2 user. |
Would it be possible to add a "configure" option like "--enable-gthreads"? |
Possible perhaps, but what would it do and how would it work? |
Maybe it would be best to modify
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Please add a flag
LIBSSH2_INIT_MULTITHREADED
tolibssh2_init(int flags)
.Openssl
andgnutls
need to be initialized in a special way in order to be thread safe.It's quite easy, but as far as I can see
libssh2
does not support a thread safe init.Openssl:
http://stackoverflow.com/questions/3919420/tutorial-on-using-openssl-with-pthreads
Gnutls:
http://gnu.ist.utl.pt/software/gnutls/manual/html_node/Multi_002dthreaded-applications.html
The text was updated successfully, but these errors were encountered: