[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Crash noticed multiple times using libssh 0.3.4


Hi Vic,

I agree with your definition of libssh as a "thread-aware" library. It is threadsafe under certain conditions, which are:
-Call ssh_init() once in the main thread before anything
-Don't call channel or ssh functions on the same session in different threads, at least not at same time.

But what I'd like would be to remove these two conditions. I'd like to be able to read in a channel in one thread and write in the same channel in an other thread. This is not possible using threading only in the caller app.
Unlike what you said, I think managing the locking in the app is not easy.

You're right that managing pthread or windows-specific threading is hard (and having a 3rd party mandatory dependency is bad). I will check which kind of threading support we need (we don't even have to launch threads ourselves, only manage mutexes as far as I see). Of course it will be optional.

Aris


Vic Lee a écrit :
Hi,

Personally, I would consider libssh is "thread-aware" or "partially
thread-safe", but not completely thread-safe. When we say something is
thread-safe it's supposed to be able to access the same object in
different threads at the same time and the object locks resources
automatically.

But I much more prefer libssh to work as it currently is, because it's a
library and better to avoid having more dependency.

One thread-safe example should be glib - it provides its own locking but
has to link to pthread or gth, which is not what I want. It shouldn't be
a big deal for the application to use its own lock.

Vic

On Sat, 2010-01-16 at 09:43 +0100, Guido Moonen wrote:
Hi All,

I have a similar problem on 0.4.0 windows build, but only in the ssh_connect function, solved it by using a mutex around the ssh_connect call. haven't seen any other threading issues.

With kind regards,
  Guido

Uday Tennety wrote:
Hello,
In our development environment, we noticed that some error in libssh library resulted in crashing our application server. We saw this issue a few times. Our scenario is: We are using libssh 0.3.4 and noticed the crash when our libssh client was trying to connect to multiple ssh servers running on various network elements. Before we dive deep into the code, I wanted to find out if there is a known threading issue in 0.3.4 with a libssh client trying to connect to multiple ssh servers? Also, it would really help if someone can point me in the right direction looking at the error. I really appreciate your time and help.

Thanks,
Uday.



Sample Error:
-------------

[func] leaving function ssh_disconnect line 690 in /home/public/temp/libssh-0.3.4/libssh/client.c [func] entering function ssh_cleanup line 91 in /home/public/temp/libssh-0.3.4/libssh/session.c [func] entering function channel_free line 724 in /home/public/temp/libssh-0.3.4/libssh/channels.c [func] leaving function channel_free line 755 in /home/public/temp/libssh-0.3.4/libssh/channels.c
Current time:Fri Jan 15 16:10:29 PST 2010
Remote host is 10.2.32.95 and remote port is 22[func] entering function ssh_connect line 489 in /home/public/temp/libssh-0.3.4/libssh/client.c [func] entering function ssh_connect_host line 184 in /home/public/temp/libssh-0.3.4/libssh/connect.c [func] leaving function ssh_connect_host line 249 in /home/public/temp/libssh-0.3.4/libssh/connect.c [func] leaving function ssh_connect_host line 258 in /home/public/temp/libssh-0.3.4/libssh/connect.c
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xff351040, pid=5438, tid=149
#
# JRE version: 6.0_16-b01
# Java VM: Java HotSpot(TM) Server VM (14.2-b01 mixed mode solaris-sparc )
# Problematic frame:
# C  [libc_psr.so.1+0x1040]  memset+0x140
#
# An error report file with more information is saved as:
# /home/IEM/Repository/hs_err_pid5438.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp






Archive administrator: postmaster@lists.cynapses.org