Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Net-SSH2 CPAN distribution.

Report information
The Basics
Id:
81074
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
Robert-jean.Denault [...] telus.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



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

 

http://emergisweb/emergis/communications/promo/THS_bbE_Fre_RGB.gif

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.

.

 

 

Image displayed inline above

Subject: Re: [rt.cpan.org #81074] Segmentation Fault when using debug(1) when releasing SFTP object (with Correction)
Date: Fri, 9 Nov 2012 11:10:52 -0500
To: bug-Net-SSH2@rt.cpan.org
From: Rafael Kitover <rkitover@gmail.com>
Hi Robert,

thanks very much for the patch, I will do a release with it right now.

On Friday, November 9, 2012 at 11:03 AM, Robert-Jean Denault via RT wrote:

Show quoted text
Fri Nov 09 11:03:45 2012: Request 81074 was acted upon.
Transaction: Ticket created by Robert-jean.Denault@telus.com
Queue: Net-SSH2
Subject: Segmentation Fault when using debug(1) when releasing SFTP object (with Correction)
Broken in: (no value)
Severity: (no value)
Owner: Nobody
Status: new


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

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.
.

Attachments:
- image001.gif

Well "right now" turned out to be a few hours later, had some work coming in :) But 0.46 with your patch has just been uploaded to CPAN. Cheers, Rafael


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.