bgi has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Yesterday I thougt that I got it...and today? Another error: This time the perl-interpreter aborts... (is this correct? aborts?)

When I was trying to play these code:

use strict; use Net::SSH2; #use Net::SSH2::Channel; my $ssh2= Net::SSH2-> new(); $ssh2-> connect('Ip address') or die; if($ssh2-> auth_password('user', 'pass')){ print "ok"; my $chan2 = $ssh2-> channel(); $ssh2-> ($chan2); print $chan2 "uname\n"; }else { print "auth failed"; }

It prints the -ok- and then a few seconds later, an error message pops up...this is what dr.watson says..

Anwendungsausnahme aufgetreten: Anwendung: G:\apps\eclipse\Perl\bin\Perl.exe (pid=1652) Wann: 21.05.2008 @ 13:21:36.759 Ausnahmenummer: c0000005 (Zugriffsverletzung) *----> Systeminformationen <----* Computername: XXX Benutzername: XXX Terminalsitzungskennung: 0 Prozessoranzahl: 2 Prozessortyp: x86 Family 6 Model 14 Stepping 8 Windows-Version: 5.1 Aktuelles Build: 2600 Service Pack: 2 Aktueller Typ: Multiprocessor Free Firma: XXX Besitzer: XXX *----> Taskliste <----* 0 System Process 4 System 444 smss.exe 500 csrss.exe 524 winlogon.exe 568 services.exe 580 lsass.exe 728 svchost.exe 808 svchost.exe 900 svchost.exe 944 svchost.exe 1232 svchost.exe 1296 svchost.exe 1492 spoolsv.exe 1536 SCardSvr.exe 1764 trcboot.exe 1828 svchost.exe 1848 FireSvc.exe 1924 FrameworkService.exe 332 Mcshield.exe 260 VsTskMgr.exe 1020 MDM.EXE 1044 NICCONFIGSVC.exe 1088 Prot_srv.exe 1116 PointSecConnect.exe 1180 naPrdMgr.exe 1200 pstartSr.exe 1528 wdService.exe 1680 CcmExec.exe 1292 wmiprvse.exe 2144 wmiprvse.exe 2388 wmiprvse.exe 3820 ctfmon.exe 3924 Explorer.EXE 1556 hkcmd.exe 228 igfxpers.exe 280 rundll32.exe 292 stsystra.exe 360 Quickset.exe 1140 igfxsrvc.exe 2360 UdaterUI.exe 2544 McTray.exe 2552 SHSTAT.EXE 3072 Communicator.exe 3084 FireTray.exe 1360 OUTLOOK.EXE 2052 firefox.exe 3728 P95Tray.exe 780 SshClient.exe 3412 workmgr.exe 3380 eclipse.exe 1652 Perl.exe 4068 drwtsn32.exe *----> Modulliste <----* (00000000003e0000 - 00000000003e6000: G:\apps\eclipse\Perl\lib\auto\IO +\IO.dll (00000000003f0000 - 00000000003f6000: G:\apps\eclipse\Perl\lib\auto\Fc +ntl\Fcntl.dll (0000000000400000 - 000000000040b000: G:\apps\eclipse\Perl\bin\Perl.ex +e (0000000001b70000 - 0000000001b75000: G:\apps\eclipse\Perl\lib\auto\Cw +d\Cwd.dll (0000000001f80000 - 0000000001f87000: G:\apps\eclipse\Perl\lib\auto\Ma +th\BigInt\FastCalc\FastCalc.dll (0000000001f90000 - 0000000001fa5000: G:\apps\eclipse\Perl\lib\auto\Wi +n32API\File\File.dll (000000000ffd0000 - 000000000fff8000: C:\WINDOWS\system32\rsaenh.dll (0000000010000000 - 0000000010007000: G:\apps\eclipse\Perl\lib\auto\So +cket\Socket.dll (0000000028000000 - 00000000280db000: G:\apps\eclipse\Perl\bin\perl510 +.dll (00000000629c0000 - 00000000629c9000: C:\WINDOWS\system32\LPK.DLL (00000000662b0000 - 0000000066308000: C:\WINDOWS\system32\hnetcfg.dll (0000000071a50000 - 0000000071a8f000: C:\WINDOWS\system32\mswsock.dll (0000000071a90000 - 0000000071a98000: C:\WINDOWS\System32\wshtcpip.dll (0000000071aa0000 - 0000000071aa8000: C:\WINDOWS\system32\WS2HELP.dll (0000000071ab0000 - 0000000071ac7000: C:\WINDOWS\system32\WS2_32.dll (0000000073080000 - 000000007309c000: C:\WINDOWS\system32\rsvpsp.dll (0000000074d90000 - 0000000074dfb000: C:\WINDOWS\system32\USP10.dll (00000000751d0000 - 00000000751ee000: C:\WINDOWS\system32\wshbth.dll (0000000076390000 - 00000000763ad000: C:\WINDOWS\system32\IMM32.DLL (0000000076f20000 - 0000000076f47000: C:\WINDOWS\system32\DNSAPI.dll (0000000076f60000 - 0000000076f8c000: C:\WINDOWS\system32\WLDAP32.dll (0000000076fb0000 - 0000000076fb8000: C:\WINDOWS\System32\winrnr.dll (0000000076fc0000 - 0000000076fc6000: C:\WINDOWS\system32\rasadhlp.dll (0000000077920000 - 0000000077a13000: C:\WINDOWS\system32\SETUPAPI.dll (0000000077b40000 - 0000000077b62000: C:\WINDOWS\system32\Apphelp.dll (0000000077c00000 - 0000000077c08000: C:\WINDOWS\system32\VERSION.dll (0000000077c10000 - 0000000077c68000: C:\WINDOWS\system32\MSVCRT.dll (0000000077dd0000 - 0000000077e6b000: C:\WINDOWS\system32\ADVAPI32.dll (0000000077e70000 - 0000000077f02000: C:\WINDOWS\system32\RPCRT4.dll (0000000077f10000 - 0000000077f57000: C:\WINDOWS\system32\GDI32.dll (0000000077f60000 - 0000000077fd6000: C:\WINDOWS\system32\SHLWAPI.dll (0000000077fe0000 - 0000000077ff1000: C:\WINDOWS\system32\Secur32.dll (000000007c800000 - 000000007c8f5000: C:\WINDOWS\system32\kernel32.dll (000000007c900000 - 000000007c9b0000: C:\WINDOWS\system32\ntdll.dll (000000007d370000 - 000000007d468000: G:\apps\eclipse\Perl\lib\auto\Ne +t\SSH2\SSH2.dll (000000007e410000 - 000000007e4a0000: C:\WINDOWS\system32\USER32.dll *----> Statusabbild für Threadkennung 0xbfc <----* eax=fb14db9b ebx=01a47424 ecx=00000000 edx=00000000 esi=fb14db9b edi=0 +0000000 eip=7d372bf4 esp=0140f908 ebp=0140f920 iopl=0 nv up ei pl nz a +c pe nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=0 +0200212 *** ERROR: Symbol file could not be found. Defaulted to export symbol +s for G:\apps\eclipse\Perl\lib\auto\Net\SSH2\SSH2.dll - Funktion: SSH2 7d372bdc 0000 add [eax],al 7d372bde 0000 add [eax],al 7d372be0 55 push ebp 7d372be1 89e5 mov ebp,esp 7d372be3 83ec18 sub esp,0x18 7d372be6 8975f8 mov [ebp-0x8],esi 7d372be9 89c6 mov esi,eax 7d372beb 897dfc mov [ebp-0x4],edi 7d372bee 8b7d08 mov edi,[ebp+0x8] 7d372bf1 895df4 mov [ebp-0xc],ebx FEHLER ->7d372bf4 8b5814 mov ebx,[eax+0x14] ds:0023:f +b14dbaf=???????? 7d372bf7 895010 mov [eax+0x10],edx 7d372bfa 85db test ebx,ebx 7d372bfc 7412 jz SSH2+0x2c10 (7d372c10) 7d372bfe 8b4304 mov eax,[ebx+0x4] 7d372c01 85c0 test eax,eax 7d372c03 743b jz SSH2+0x2c40 (7d372c40) 7d372c05 48 dec eax 7d372c06 85c0 test eax,eax 7d372c08 894304 mov [ebx+0x4],eax 7d372c0b 7446 jz SSH2+0x2c53 (7d372c53) *----> Stack Back Trace <----* WARNING: Stack unwind information not available. Following frames may +be wrong. *** WARNING: Unable to verify checksum for G:\apps\eclipse\Perl\bin\pe +rl510.dll *** ERROR: Symbol file could not be found. Defaulted to export symbol +s for G:\apps\eclipse\Perl\bin\perl510.dll - *** WARNING: Unable to verify checksum for G:\apps\eclipse\Perl\bin\Pe +rl.exe *** ERROR: Module load completed but symbols could not be loaded for G +:\apps\eclipse\Perl\bin\Perl.exe *** ERROR: Symbol file could not be found. Defaulted to export symbol +s for C:\WINDOWS\system32\kernel32.dll - ChildEBP RetAddr Args to Child 0140f920 7d372c84 00000000 0022633c 0140f960 SSH2+0x2bf4 0140f930 7d37b141 7d436882 7d4360b1 00000000 SSH2+0x2c84 0140f960 28047d90 00226014 01979e0c 00000000 SSH2+0xb141 0140f9a8 2802a389 01226014 0022aa74 00226014 perl510!Perl_find_runcv+0 +x9716 0140fa5c 280748ce 00226014 01979e0c 00000096 perl510!Perl_call_sv+0x27 +b 0140fa88 28074e15 01d65704 00000009 0022ad04 perl510!Perl_sv_clear+0x1 +6a 0140fad8 28074e15 00226014 00000004 ffffffff perl510!Perl_sv_free2+0x4 +6 0140fb7c 2809e1dd 00226014 00000000 2463eebc perl510!Perl_sv_free2+0x4 +6 0140ff3c 00401012 00000005 002224e8 01222d60 perl510!RunPerl+0xed 0140ffc0 7c816fd7 00000000 2463eebc 7ffdd000 Perl+0x1012 0140fff0 00000000 00401016 00000000 00000000 kernel32!RegisterWaitForI +nputIdle+0x49 *----> Raw Stack Dump <----* 000000000140f908 54 93 96 01 2c 00 00 00 - 14 60 22 00 24 74 a4 01 T +...,....`".$t.. 000000000140f918 01 00 00 00 30 16 c6 01 - 30 f9 40 01 84 2c 37 7d . +...0...0.@..,7} 000000000140f928 00 00 00 00 3c 63 22 00 - 60 f9 40 01 41 b1 37 7d . +...<c".`.@.A.7} 000000000140f938 82 68 43 7d b1 60 43 7d - 00 00 00 00 00 00 00 00 . +hC}.`C}........ 000000000140f948 00 00 00 00 00 00 00 00 - 00 00 00 00 0c 9e 97 01 . +............... 000000000140f958 14 60 22 00 3c 63 22 00 - a8 f9 40 01 90 7d 04 28 . +`".<c"...@..}.( 000000000140f968 14 60 22 00 0c 9e 97 01 - 00 00 00 00 14 60 22 00 . +`"..........`". 000000000140f978 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 . +............... 000000000140f988 48 60 22 00 cf 06 04 28 - 80 00 00 00 48 60 22 00 H +`"....(....H`". 000000000140f998 14 60 22 00 0c 9e 97 01 - d5 a2 02 28 28 74 a4 01 . +`"........((t.. 000000000140f9a8 5c fa 40 01 89 a3 02 28 - 14 60 22 01 74 aa 22 00 \ +.@....(.`".t.". 000000000140f9b8 14 60 22 00 28 74 a4 01 - 2c fb 40 01 5c fa 40 01 . +`".(t..,.@.\.@. 000000000140f9c8 00 00 00 00 00 00 00 00 - 14 60 22 00 a0 f9 40 01 . +........`"...@. 000000000140f9d8 d5 a2 02 28 b0 ff 40 01 - 00 00 00 00 30 32 43 56 . +..(..@.....02CV 000000000140f9e8 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 . +............... 000000000140f9f8 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 . +............... 000000000140fa08 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 . +............... 000000000140fa18 14 60 22 00 04 57 d6 01 - 3c 7f 87 01 00 00 00 00 . +`"..W..<....... 000000000140fa28 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 . +............... 000000000140fa38 00 00 00 00 41 00 00 00 - 00 00 00 00 28 fa 40 01 . +...A.......(.@.

What to do?? What do you think: Windows Error, Error in Module, perhaps the module is not running correct in Windows?

Replies are listed 'Best First'.
Re: Net::SSH2::Channel failure on Windows XP
by moritz (Cardinal) on May 21, 2008 at 14:08 UTC
    For all the non-Germans here: the error message basically says "segmentation fault".
    if($ssh2-> auth_password('user', 'pass')){ print "ok"; my $chan2 = $ssh2-> channel(); $ssh2-> ($chan2);
    That last line looks suspicious. $foo->($stuff) treats $foo as a sub ref, and passes $stuff to it. I don't think $ssh2 is a sub ref, so try to do without that line.

    (Still perl shouldn't crash on it IMHO).

Re: Net::SSH2::Channel failure on Windows XP
by zentara (Cardinal) on May 21, 2008 at 16:43 UTC
    This is just a WAG, but maybe you need to solidify your auth, before you try and get a channel? Also what is $ssh2-> ($chan2);?
    #instead of if($ssh2-> auth_password('user', 'pass')){ print "ok"; my $chan2 = $ssh2-> channel(); $ssh2-> ($chan2); #what is this step? print $chan2 "uname\n"; #try it without the if block $ssh2->auth_password('user','pass') or die "Unable to login $@ \n"; + my $chan = $ssh2->channel(); + $chan->blocking(0); + $chan->exec('ls -la'); + while (<$chan>){ print } + #$chan->close;

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re: Net::SSH2::Channel failure on Windows XP
by bgi (Sexton) on May 21, 2008 at 15:26 UTC
    test suit..? The only thing I know is perl -e "use Module::Name;"

    Hmm I guess the Code is correct...I copied ist out of these forum while I was searching code examples...it works also without these line...

    It breaks at this line:
    my $chan2 = $ssh2-> channel();

    Any ideas..?
Re: Net::SSH2::Channel failure on Windows XP
by syphilis (Archbishop) on May 22, 2008 at 07:52 UTC
    Does this do what you want:
    use Net::SSH2; use warnings; use strict; my $buflen = 100; my $buf = '0' x $buflen; my $ssh2 = Net::SSH2->new(); $ssh2->connect('IP Address') or die; $ssh2->auth_password('user','pass') or die "Unable to login $! \n"; my $chan1 = $ssh2->channel(); $chan1->blocking(1); $chan1->exec('uname'); $chan1->read($buf, $buflen); print "BUF: ", $buf, "\n"; $chan1->close; __END__
    That works fine for me on Windows with perl 5.8.8. (The script you posted did not.) But it segfaults on perl 5.10.0 on Windows. (There are issues with Net::SSH2 on perl 5.10 ... and not just windows issues. See eg http://rt.cpan.org/Ticket/Display.html?id=36071.)

    Cheers,
    Rob
Re: Net::SSH2::Channel failure on Windows XP
by Anonymous Monk on May 21, 2008 at 14:31 UTC
    I guess you did not run the test suite
Re: Net::SSH2::Channel failure on Windows XP
by bgi (Sexton) on May 22, 2008 at 12:42 UTC
    Hi, thank you for your help....
    I will downgrade to 5.8, and try it again...aaaand wil post the results...

    THANK YOU GUYS!!!!