Subject: [ libssh2-Bugs-2809118 ] Deadlock in libssh2_session_free

[ libssh2-Bugs-2809118 ] Deadlock in libssh2_session_free

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Tue, 28 Jul 2009 17:38:53 +0000

Bugs item #2809118, was opened at 2009-06-19 17:50
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2809118&group_id=125852

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: misc
Group: None
>Status: Pending
>Resolution: Works For Me
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: Deadlock in libssh2_session_free

Initial Comment:
I don't really know if the problem originates in libssh2 code, but it's the best guess I could think of.

I have a Perl program (using Net::SSH2) running as a CORBA deamon (using mico XS-bindings from http://sourceforge.net/projects/corba-mico/). The CORBA server creates SSH tunnels to remote hosts and communicates (non blocking mode) with other servers beyond the other end of the tunnel. SSH Tunnels are kept open as long as possible and are reinitialized if the connection is lost.
This works fine, usually. But every now and then the whole process blocks.

This happens on SuSE Linux Enterprise 10.2, 64Bit, gcc 4.1.2 20070115 (SUSE Linux) using Perl 5.10.0, Net::SSH2 0.19, and libssh2 1.1.

I've attached the stack trace of the (still running) process below.

Thanks in advance for your effort!
Heiko

#0 0x00002ab6fe7d0918 in __lll_mutex_lock_wait () from /lib64/libc.so.6
#1 0x00002ab6fe774bff in _L_lock_3988 () from /lib64/libc.so.6
#2 0x00002ab6fe771b71 in free () from /lib64/libc.so.6
#3 0x00002ab6fdcb9426 in _dl_map_object_deps () from /lib64/ld-linux-x86-64.so.2
#4 0x00002ab6fdcbe02d in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
#5 0x00002ab6fdcba1f6 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#6 0x00002ab6fdcbdacb in _dl_open () from /lib64/ld-linux-x86-64.so.2
#7 0x00002ab6fe7f7600 in do_dlopen () from /lib64/libc.so.6
#8 0x00002ab6fdcba1f6 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
#9 0x00002ab6fe7f76b5 in dlerror_run () from /lib64/libc.so.6
#10 0x00002ab6fe7f7787 in __libc_dlopen_mode () from /lib64/libc.so.6
#11 0x00002ab6fe7d5d7a in init () from /lib64/libc.so.6
#12 0x00002ab6fe5f711d in pthread_once () from /lib64/libpthread.so.0
#13 0x00002ab6fe7d5e05 in backtrace () from /lib64/libc.so.6
#14 0x00002ab6fe76b51f in __libc_message () from /lib64/libc.so.6
#15 0x00002ab6fe7704fe in malloc_printerr () from /lib64/libc.so.6
#16 0x00002ab6fe771b7c in free () from /lib64/libc.so.6
#17 0x00002ab700a4a379 in libssh2_session_free (session=0x1522d90) at session.c:843
#18 0x00002ab7009315cc in XS_Net__SSH2_DESTROY ()
   from /digibib/tools/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi-ld/auto/Net/SSH2/SSH2.so
#19 0x00002ab6fde6c2db in Perl_pp_entersub () from /digibib/ips/lib/libperl.so
#20 0x00002ab6fde65c57 in Perl_call_sv () from /digibib/ips/lib/libperl.so
#21 0x00002ab6fde7d5f0 in Perl_sv_clear () from /digibib/ips/lib/libperl.so
#22 0x00002ab6fde7ddb2 in Perl_sv_free2 () from /digibib/ips/lib/libperl.so
#23 0x00002ab6fde97fac in Perl_free_tmps () from /digibib/ips/lib/libperl.so
#24 0x00002ab6fde6d9e0 in Perl_pp_nextstate () from /digibib/ips/lib/libperl.so
#25 0x00002ab6fde6a8ee in Perl_runops_standard () from /digibib/ips/lib/libperl.so
#26 0x00002ab6fde65b65 in Perl_call_sv () from /digibib/ips/lib/libperl.so
#27 0x00002ab6ff422275 in pmico_call_method (name=0x14a54b8 "perform", return_items=1, exceptions=0x1274aa0)
    at server.cc:288
#28 0x00002ab6ff42354b in PMicoServant::invoke (this=0x686a60, _req=0x14a7c60) at server.cc:834
#29 0x00002ab6ff8a4193 in MICOPOA::POA_impl::perform_invoke () from /digibib/tools/lib/libmico2.3.13.so
#30 0x00002ab6ff8a70a2 in MICOPOA::POA_impl::local_invoke () from /digibib/tools/lib/libmico2.3.13.so
#31 0x00002ab6ff8a773a in MICOPOA::POA_impl::invoke () from /digibib/tools/lib/libmico2.3.13.so
#32 0x00002ab6ff7fd8aa in CORBA::ORB::invoke_async () from /digibib/tools/lib/libmico2.3.13.so
#33 0x00002ab6ff81e5f0 in MICO::IIOPServer::exec_invoke_request () from /digibib/tools/lib/libmico2.3.13.so
#34 0x00002ab6ff8290f6 in MICO::IIOPServer::handle_invoke_request () from /digibib/tools/lib/libmico2.3.13.so
#35 0x00002ab6ff8297be in MICO::IIOPServer::handle_input () from /digibib/tools/lib/libmico2.3.13.so
#36 0x00002ab6ff829e98 in MICO::IIOPServer::input_callback () from /digibib/tools/lib/libmico2.3.13.so
#37 0x00002ab6ff82a2f7 in MICO::GIOPConn::do_read () from /digibib/tools/lib/libmico2.3.13.so
#38 0x00002ab6ff7e420b in MICO::SelectDispatcher::handle_fevents () from /digibib/tools/lib/libmico2.3.13.so
#39 0x00002ab6ff7e5823 in MICO::SelectDispatcher::run () from /digibib/tools/lib/libmico2.3.13.so
#40 0x00002ab6ff7fb9cf in CORBA::ORB::run () from /digibib/tools/lib/libmico2.3.13.so
#41 0x00002ab6ff4074c6 in XS_CORBA__ORB_run (my_perl=<value optimized out>, cv=<value optimized out>) at MICO.xs:406
#42 0x00002ab6fde6c2db in Perl_pp_entersub () from /digibib/ips/lib/libperl.so
#43 0x00002ab6fde6a8ee in Perl_runops_standard () from /digibib/ips/lib/libperl.so
#44 0x00002ab6fde6631c in perl_run () from /digibib/ips/lib/libperl.so
#45 0x0000000000400d2c in main ()

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2009-07-28 19:38

Message:
Thanks for your help on improving libssh2!

We need more details on this bug entry to be able to sort it out properly,
and until more info is provided this entry will be set to 'pending' status
and will get closed automatically at a later date unless feedback has been
given.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2009-07-07 11:28

Message:
I'm sorry, but exactly how can a single-threaded lib such as libssh2
dead-lock on this? I realize you have a problem but I don't' see libssh2
causes this.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2809118&group_id=125852
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2009-07-28