CC: | <dbrobins [...] davidrobins.net> |
Subject: | Core when using Perl 5.10 |
Date: | Fri, 03 Oct 2008 03:05:25 +0200 |
To: | <bug-Net-SSH2 [...] rt.cpan.org> |
From: | "Heiko Jansen" <jansen [...] hbz-nrw.de> |
It looks like there's a problem with Net::SSH2 when used with Perl 5.10.
I was able to reproduce the problem described below on SLES 10.1 on x86_64, RHEL 5.1 on x86_64 and also on openSUSE 11.0 on x86_32.
Things work fine on Solaris 10, SPARC 64Bit with Perl 5.8.8 (have no Perl 5.10 there yet).
I discovered it in my own application, but it can easily be replicated with the included ~/example/read.pl.
If - after compiling and installing Net::SSH2 - I invoke read.pl I get a core with this stack:
#0 0x00002b821a183966 in set_error () from /digibib/tools/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi-ld/auto/Net/SSH2/SSH2.so
#1 0x00002b821a18e8d3 in XS_Net__SSH2__Channel_blocking () from /digibib/tools/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi-ld/auto/Net/SSH2/SSH2.so
#2 0x00002b821928a37b in Perl_pp_entersub () from /digibib/tools/lib/perl5/5.10.0/x86_64-linux-thread-multi-ld/CORE/libperl.so
#3 0x00002b821928898e in Perl_runops_standard () from /digibib/tools/lib/perl5/5.10.0/x86_64-linux-thread-multi-ld/CORE/libperl.so
#4 0x00002b8219284587 in perl_run () from /digibib/tools/lib/perl5/5.10.0/x86_64-linux-thread-multi-ld/CORE/libperl.so
#5 0x0000000000400d2c in main ()
If I comment out the call " $chan->blocking(1);" in line 307 of SSH.pm read.pl still crashes but the stack changes to:
#0 0x00002b293b7b1966 in set_error () from /digibib/tools/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi-ld/auto/Net/SSH2/SSH2.so
#1 0x00002b293b7b93d9 in XS_Net__SSH2__Channel_read () from /digibib/tools/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi-ld/auto/Net/SSH2/SSH2.so
#2 0x00002b293a8b837b in Perl_pp_entersub () from /digibib/tools/lib/perl5/5.10.0/x86_64-linux-thread-multi-ld/CORE/libperl.so
#3 0x00002b293a8b698e in Perl_runops_standard () from /digibib/tools/lib/perl5/5.10.0/x86_64-linux-thread-multi-ld/CORE/libperl.so
#4 0x00002b293a8b2587 in perl_run () from /digibib/tools/lib/perl5/5.10.0/x86_64-linux-thread-multi-ld/CORE/libperl.so
#5 0x0000000000400d2c in main ()
I had a look at the generated SSH2.c and I'm pretty sure that there's something wrong with this expression:
ch = (SSH2_CHANNEL *)SvIVX((SV*)SvRV(ST(0)));
which appears both in XS_Net__SSH2__Channel_blocking and XS_Net__SSH2__Channel_read.
But since I do know almost nothing about XS I haven't got an idea what's wrong with that (or how it's generated and how to take influence on that).
My env:
gcc -v
Using built-in specs.
Target: x86_64-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 --enable-languages=c,c++,objc,fortran,obj-c++,java,ada --enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.1.2 --enable-ssp --disable-libssp --disable-libgcj --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=new --program-suffix= --enable-version-specific-runtime-libs --without-system-libunwind --with-cpu=generic --host=x86_64-suse-linux
Thread model: posix
gcc version 4.1.2 20070115 (prerelease) (SUSE Linux)
uname -a
Linux puella 2.6.16.46-0.12-smp #1 SMP Thu May 17 14:00:09 UTC 2007 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/SuSE-release
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 1
perl -V
Summary of my perl5 (revision 5 version 10 subversion 0) configuration:
Platform:
osname=linux, osvers=2.6.16.46-0.12-smp, archname=x86_64-linux-thread-multi-ld
uname='linux puella 2.6.16.46-0.12-smp #1 smp thu may 17 14:00:09 utc 2007 x86_64 x86_64 x86_64 gnulinux '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=define
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='4.1.2 20070115 (prerelease) (SUSE Linux)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
alignbytes=16, prototype=define
Linker and Libraries:
ld='gcc', ldflags ='-L/digibib/tools/lib -L/usr/local/lib64 -L/usr/lib64 -L/lib64 -L/usr/local/lib -L/usr/lib -L/lib -R/digibib/tools/lib'
libpth=/digibib/tools/lib /usr/local/lib64 /usr/lib64 /lib64 /usr/local/lib /usr/lib /lib
libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.4.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.4'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/digibib/tools/lib/perl5/5.10.0/x86_64-linux-thread-multi-ld/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -L/digibib/tools/lib -L/usr/local/lib64 -L/usr/lib64 -L/lib64 -L/usr/local/lib -L/usr/lib -L/lib -R/digibib/tools/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LONG_DOUBLE USE_PERLIO USE_REENTRANT_API
Built under linux
Compiled at Jun 10 2008 17:33:17
@INC:
/digibib/tools/lib/perl5/5.10.0/x86_64-linux-thread-multi-ld
/digibib/tools/lib/perl5/5.10.0
/digibib/tools/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi-ld
/digibib/tools/lib/perl5/site_perl/5.10.0
/digibib/perl/lib/perl5/x86_64-linux-thread-multi-ld
/digibib/perl/lib/perl5
.
As you probably recognize I built my own perl and did not use one provided by Novell/SUSE.
libssh2 is latest released version 0.18
If you could come up with a patch that would be highly appreciated (I'm simply in dire need of Net::SSH2).
If you need someone to test a patch, please let me know.
Heiko