Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/crypto/ssh: unexpected packet #6169

Closed
gopherbot opened this issue Aug 16, 2013 · 9 comments
Closed

x/crypto/ssh: unexpected packet #6169

gopherbot opened this issue Aug 16, 2013 · 9 comments

Comments

@gopherbot
Copy link

by maciek@heroku.com:

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Run this test in sshpool: https://github.com/kr/sshpool/blob/master/pool_test.go#L108

What is the expected output?

The session should fail (due to the timeout) with a well-understood error

What do you see instead?

This will hit this unexpected code path in ssh/channel.go:
code.google.com/p/go/source/browse/ssh/channel.go?repo=crypto#489


Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Ubuntu 13.04 / Linux 3.8.0-27 x86_64

Which version are you using?  (run 'go version')

go version devel +01810e5c68e9 Mon Jun 03 13:20:17 2013 +0400 linux/amd64
@robpike
Copy link
Contributor

robpike commented Aug 17, 2013

Comment 1:

Labels changed: added priority-later, removed priority-triage, go1.2maybe.

Status changed to Accepted.

@hanwen
Copy link
Contributor

hanwen commented Aug 21, 2013

Comment 2:

I can't reproduce this on 
go version devel +cddeaea05b11 Wed Aug 21 18:51:37 2013 +0400 linux/amd64
go.crypto: 
parent: 142:1e7a3e301825 tip
 openpgp: Implement compressed data packets & add support for compressing data during symmetric encryption.
I'm on ubuntu 12.04.
$ go test -v 
=== RUN TestOpenReuse
--- PASS: TestOpenReuse (0.09 seconds)
=== RUN TestSessionTimeout
--- PASS: TestSessionTimeout (0.17 seconds)
=== RUN TestOpenDistinct
--- PASS: TestOpenDistinct (0.16 seconds)
=== RUN TestOpenFirstError
--- PASS: TestOpenFirstError (0.00 seconds)
=== RUN TestOpenRetry
--- PASS: TestOpenRetry (0.10 seconds)
=== RUN TestOpenSecondError
--- PASS: TestOpenSecondError (0.08 seconds)
PASS
ok      github.com/kr/sshpool   0.761s
can you see if what part of your environment causes this?
alternatively, it would be helpful to know the packet type, eg. changing the SSH error
to fmt.Errorf("%T", msg)

@gopherbot
Copy link
Author

Comment 3 by maciek@heroku.com:

Sorry if I wasn't clear: this *doesn't* actually visibly manifest when you run the test
suite, because we've made `sshpool` more resilient to errors. But it *is* triggered;
that is, the "unexpected packet" error I mentioned above in `channel.go` is hit (it's
just that sshpool now works around it, like it works around connectivity errors).
I filed a bug because "unexpected packet" presumably means that a violation of some
internal contract is being hit: this doesn't seem like an error that a user should ever
see with a well-behaved client.
I'll tweak a branch of sshpool to actually print this error.

@gopherbot
Copy link
Author

Comment 4 by maciek@heroku.com:

Ok, it looks like the current version of sshpool no longer triggers it due to some
reconnection logic changes. If I go back to `f7f9e575cb90c1cb120028cc228b4e458053c227`
in sshpool and make the following change to `channel.go` in the `ssh` package:
```
maciek@gamera:~/code/go/src/code.google.com/p/go.crypto/ssh$ hg diff .
diff -r 9c36e9eca3b5 ssh/channel.go
--- a/ssh/channel.go    Mon Jul 29 15:32:19 2013 -0400
+++ b/ssh/channel.go    Thu Aug 22 13:51:10 2013 -0700
@@ -485,6 +485,8 @@
        return nil
    case *channelOpenFailureMsg:
        return errors.New(safeString(msg.Message))
+   default:
+       fmt.Printf("ssh: unexpected packet %v\n", msg)
    }
    return errors.New("ssh: unexpected packet")
 }
```
I see that the unexpected packet is actually `nil`:
ssh: unexpected packet <nil>

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 5:

Labels changed: added go1.3maybe.

@dsymonds
Copy link
Contributor

dsymonds commented Dec 4, 2013

Comment 6:

Labels changed: added packagebug, removed priority-later.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 7:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 8:

Labels changed: added repo-crypto.

@mikioh mikioh changed the title go.crypto/ssh: unexpected packet in go.crypto/ssh ssh: unexpected packet Jan 7, 2015
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title ssh: unexpected packet x/crypto/ssh: unexpected packet Apr 14, 2015
@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015
@rsc rsc removed the repo-crypto label Apr 14, 2015
@hanwen
Copy link
Contributor

hanwen commented Aug 12, 2015

this is from before the big rewrite. This can be closed.

@ianlancetaylor

@hanwen hanwen closed this as completed Aug 13, 2015
@golang golang locked and limited conversation to collaborators Aug 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants