Skip to content

Commit

Permalink
Merge pull request #316 from ystia/bugfix/GH-315_fix_panic_ssh_pool
Browse files Browse the repository at this point in the history
Fixed panic in case of ssh connection error
  • Loading branch information
loicalbertin authored Feb 13, 2019
2 parents e9ac5e0 + bc15bcf commit 54fe3fc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
16 changes: 10 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## UNRELEASED

### BUG FIXES

* SSH Session pool: Panic if connection failed, this impacts Slurm infrastructure ([GH-315](https://github.com/ystia/yorc/issues/315))

## 3.1.1 (February 06, 2019)

### BUG FIXES
Expand All @@ -10,13 +14,13 @@
* Can't deploy applications using a secured yorc/consul ([GH-274](https://github.com/ystia/yorc/issues/274))
* Unable to purge an application that appears in the list ([GH-238](https://github.com/ystia/yorc/issues/238))
* K8S jobs namespace should not be removed if its provided ([GH-245](https://github.com/ystia/yorc/issues/245))
* Deployment with a topology parsing error remains in initial status ([GH-283](https://github.com/ystia/yorc/issues/283)
* Interface name is not retrieved from custom command Rest request ([GH-287](https://github.com/ystia/yorc/issues/287)
* Instances are adding into topology before creating task ([GH-289](https://github.com/ystia/yorc/issues/289)
* All ssh connections to Slurm are killed if ssh server has reached the max number of allowed sessions ([GH-291](https://github.com/ystia/yorc/issues/291)
* Deployment with a topology parsing error remains in initial status ([GH-283](https://github.com/ystia/yorc/issues/283))
* Interface name is not retrieved from custom command Rest request ([GH-287](https://github.com/ystia/yorc/issues/287))
* Instances are adding into topology before creating task ([GH-289](https://github.com/ystia/yorc/issues/289))
* All ssh connections to Slurm are killed if ssh server has reached the max number of allowed sessions ([GH-291](https://github.com/ystia/yorc/issues/291))
* Missing events for uninstall workflow in purge task ([GH-302](https://github.com/ystia/yorc/issues/302)
* It can take a considerable delay for a deployment to change status to UNDEPLOYMENT_IN_PROGRESS ([GH-306](https://github.com/ystia/yorc/issues/306)
* Slurm job monitoring is not designed for concurrency ([GH-308](https://github.com/ystia/yorc/issues/308)
* It can take a considerable delay for a deployment to change status to UNDEPLOYMENT_IN_PROGRESS ([GH-306](https://github.com/ystia/yorc/issues/306))
* Slurm job monitoring is not designed for concurrency ([GH-308](https://github.com/ystia/yorc/issues/308))

## 3.1.0 (December 20, 2018)

Expand Down
13 changes: 11 additions & 2 deletions helper/sshutil/session_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,17 @@ func (p *pool) getConn(k, addr string, config *ssh.ClientConfig) *conn {
p.tab[k] = c
p.mu.Unlock()
c.netC, c.c, c.err = p.dial("tcp", addr, config)
c.name = fmt.Sprintf("%s-%s-%x", addr, config.User, c.c.SessionID())
metrics.IncrCounter(metricsutil.CleanupMetricKey([]string{"ssh-connections-pool", "creations", c.name}), 1)
// Add context to the error if any
c.err = errors.Wrapf(c.err, "failed to open connection on %s", addr)
if c.err == nil {
// Connection succeeded
c.name = fmt.Sprintf("%s-%s-%x", addr, config.User, c.c.SessionID())
metrics.IncrCounter(metricsutil.CleanupMetricKey([]string{"ssh-connections-pool", "creations", c.name}), 1)
} else {
// Connection failed
c.name = fmt.Sprintf("%s-%s", addr, config.User)
metrics.IncrCounter(metricsutil.CleanupMetricKey([]string{"ssh-connections-pool", "create-failed", c.name}), 1)
}
close(c.ok)
return c
}
Expand Down

0 comments on commit 54fe3fc

Please sign in to comment.