php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39683 SSH does not disconnect gracefully
Submitted: 2006-11-29 14:42 UTC Modified: 2006-11-29 14:51 UTC
From: peter dot wilton-jones at eads dot com Assigned:
Status: Not a bug Package: *Network Functions
PHP Version: 5.2.0 OS: Windows 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 + 17 = ?
Subscribe to this entry?

 
 [2006-11-29 14:42 UTC] peter dot wilton-jones at eads dot com
Description:
------------
I have a page that refreshes every minute. In that page, I open an ssh session and obtain data. There is no way to close the ssh connection. On reload, php opens a new connection but does not terminate the last one or reuse the existing one.
Running a NETSTAT command reveals numerous connections in the CLOSE_WAIT status after several minutes.
Can a close SSH option be included?

Reproduce code:
---------------
<?php
$connection = ssh2_connect('myserver',22);
ssh2_auth_password($connection,'username','password');
$stream = ss2_exec($connection,'df -k',FALSE);
stream_set_blocking($stream, TRUE);
$output = fread($stream,4096);
fclose($stream);
echo $output;
?>

Expected result:
----------------
Connection should show nothing

Actual result:
--------------
netstat -a shows

----------------
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
TCP     myweb:xxxx      myserver:22         CLOSE_WAIT
---------------

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-29 14:51 UTC] tony2001@php.net
Please report issues in PECL modules using PECL bug tracker.
http://pecl.php.net/bugs/search.php?cmd=display&status=Open&package_name[]=ssh2
Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 14:01:31 2024 UTC