Hi Leo,

Leo wrote:
> Now when I try to connect to SFTP site, the crash produces the following 
> output in Xcode debugger:
> 
> openssl.c > _libssh2_openssl_crypto_init()
> 
> 
> #if OPENSSL_VERSION_NUMBER >= 0x10100000L && \
>  ?????? !defined(LIBRESSL_VERSION_NUMBER)
>  ?????? #ifndef OPENSSL_NO_ENGINE
>  ?????????????? 
> ENGINE_load_builtin_engines();?????????????????????????????????? <-- Thread 
> 8: 
> EXC_BAD_ACCESS (code=1, address=0x116)
>  ?????????????? ENGINE_register_all_complete();
>  ?????? #endif
> 
> 
> As you suggested, I also inserted libssh2_trace(session, ~0); after the 
> call to libssh2_session_init() but before the call to 
> libssh2_session_handshake() - but the crash happens before getting to 
> that line.

That's good information.

It seems like you have no explicit call to libssh2_init() at startup
of your application, since you write that the crash happens when
trying to *connect* to an SFTP server.

I guess that you either have a call to libssh2_init() in a
constructor related to SFTP, that's not so good, because the library
should only be initialized a single time in a single thread for each
process.

I guess that OpenSSL was somehow already initialized, and the crash
happens becuse OpenSSL does not support being initialized twice.

If this is the case, please move or add the libssh2_init() call into your
application startup, immediately on startup, before any user interaction.

Then only call libssh2_session_init() in your SFTP constructor.

Let me know how it goes.


//Peter
_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to