Subject: | Segmentation Fault when using debug(1) when releasing SFTP object (with Correction) |
Date: | Fri, 9 Nov 2012 11:03:02 -0500 |
To: | "bug-Net-SSH2 [...] rt.cpan.org" <bug-Net-SSH2 [...] rt.cpan.org> |
From: | Robert-Jean Denault <Robert-jean.Denault [...] telus.com> |
When creating an sftp object using the with debugging turned on $ssh2->debug(1). The Perl instance will die with a segment violation when the SFTP object goes out of scope. The same code run with $ssh2->debug(0), will run successfully.
Result of the Debug session:
libssh2_sftp_init(ss->session) -> 0x1ef11180
hv_from_attrs: attrs->flags = 15
libssh2_sftp_open_ex(sf->sftp, (char*)pv_dir, len_dir, 0 , 0 , 1) -> 0x1ef10200
hv_from_attrs: attrs->flags = 15
hv_from_attrs: attrs->flags = 15
hv_from_attrs: attrs->flags = 15
hv_from_attrs: attrs->flags = 15
hv_from_attrs: attrs->flags = 15
hv_from_attrs: attrs->flags = 15
hv_from_attrs: attrs->flags = 15
Net::SSH2::Dir::DESTROY
Net::SSH2::SFTP::DESTROY
Segmentation fault
This occurs with Distribution Net-SSH2-0.33 and Net-SSH2-0.45
Perl version: This is perl 5, version 12, subversion 1 (v5.12.1) built for x86_64-linux-thread-multi
OS Verndor: Linux RHEL-GW-try1 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
Correction:
diff -c Net-SSH2-0.45/SSH2.xs ../SSH2.xs
*** Net-SSH2-0.45/SSH2.xs 2012-04-25 11:02:29.000000000 -0400
--- ../SSH2.xs 2012-11-08 18:10:07.000000000 -0500
***************
*** 1487,1493 ****
debug("%s::DESTROY\n", class);
clear_error(sf->ss);
libssh2_sftp_shutdown(sf->sftp);
! debug("%s::DESTROY freeing session\n");
SvREFCNT_dec(sf->sv_ss);
Safefree(sf);
--- 1487,1493 ----
debug("%s::DESTROY\n", class);
clear_error(sf->ss);
libssh2_sftp_shutdown(sf->sftp);
! debug("%s::DESTROY freeing session\n", class);
SvREFCNT_dec(sf->sv_ss);
Safefree(sf);
Robert Denault
Programmeur-analyste principal II/ Senior Programmer-Analyst II
TELUS Solutions en santé | avec l'expertise d'Emergis
TELUS Health Solutions | backed by Emergis
T : (450) 928 6000 x 3740
T : 1 (866) 363 7447 x 3740
robert.denault@telus.com
telussante.com telushealth.com
[cid:image001.gif@01CDBE69.C4F13CC0]
Le présent courriel et tout document joint sont destinés uniquement à la personne ou à l'entité à qui il est adressé et peut contenir des renseignements confidentiels. Si vous n'êtes pas le destinataire visé, veuillez nous en informer sans délai et détruire le courriel et les documents ainsi que toute copie qui en aurait été faite. Merci.
This message and any accompanying attachments are intended only for the person(s) to whom this message is addressed and may contain privileged, proprietary and/or confidential information. Any unauthorized use, disclosure, reproduction or distribution of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and permanently delete or destroy this message, including any attachments. Thank you.
.
Message body is not shown because it is too large.