Bug 191089 - ports-mgmt/pkg: If the sshd process is killed before 'pkg ssh' quits pkg will not terminate and consume 100% CPU
Summary: ports-mgmt/pkg: If the sshd process is killed before 'pkg ssh' quits pkg will...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-pkg (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-16 18:16 UTC by Derek Schrock
Modified: 2014-08-05 08:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Derek Schrock 2014-06-16 18:16:35 UTC
When using an ssh://host/path repo location an ssh connection is created to the host and 'pkg ssh' is executed.

If the sshd process is killed/timeouts/brokenpipe the pkg process on the host is not terminated and consumes 100% CPU.

The below was tested by manually killing the sshd process however I've seen the same results when the connection was broken with a broken pipe message on the client.

#################################################

Reproduce:

Client:

1) Execute a pkg command that connects to the host and prompts the user for input (pkg upgrade)
2) On the host kill the sshd process related to the 'pkg ssh' process
3) See 'pkg ssh' didn't die and now consumes 100% CPU

client$ pkg -v
1.2.7_3

client# pkg upgrade
Updating repository catalogue
....
The upgrade will require 4 MB more space

24 MB to be downloaded

Proceed with upgrading packages [y/N]: 

------------

Host:

host$ pkg -v
1.2.7_3

host$ ps aux | grep pkgrepo
...
pkgrepo 83886   0.0  0.0  65484   7336  -  I     1:56PM     0:00.01 sshd: pkgrepo@notty (sshd)
pkgrepo 83887   0.0  0.0  53032   7600  -  Is    1:56PM     0:00.02 /usr/local/sbin/pkg ssh
...

host# kill 83886

output from top:

83887 pkgrepo       1  94    0 53032K  7600K CPU0    0   0:14  75.98% /usr/local/sbin/pkg ssh
...
83887 pkgrepo       1 103    0 53032K  7600K CPU2    2   0:51 100.00% /usr/local/sbin/pkg ssh
...
83887 pkgrepo       1 103    0 53032K  7600K CPU2    2   1:03 100.00% /usr/local/sbin/pkg ssh


#################################################

Expected:
'pkg ssh' process would terminate if the ssh connection is lost.
Comment 1 John Marino freebsd_committer freebsd_triage 2014-06-18 21:43:57 UTC
over to maintainer
Comment 2 Baptiste Daroussin freebsd_committer freebsd_triage 2014-08-05 08:14:58 UTC
Fixed