Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

[v4] Push over ssh is hanging #433

Closed
orirawlings opened this issue Jun 16, 2017 · 1 comment
Closed

[v4] Push over ssh is hanging #433

orirawlings opened this issue Jun 16, 2017 · 1 comment

Comments

@orirawlings
Copy link
Contributor

When trying to push changes over ssh I'm facing a situation where the go process hangs in the (*Repository).Push() call. I'm able to reproduce with the example push code distributed with the gopkg.in/src-d/go-git.v4 project.

I start by just setting up a local repository and creating a new commit:

$ git clone [email protected]:orirawlings/test.git test
Cloning into 'test'...
remote: Counting objects: 29, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 29 (delta 3), reused 29 (delta 3), pack-reused 0
Receiving objects: 100% (29/29), done.
Resolving deltas: 100% (3/3), done.
$ cd test
$ echo 'a change' >> file && git add file && git commit -m 'Add change'
[master a8a21a7] Add change
 1 file changed, 1 insertion(+)
$ cd ../

I then try to push the change using the example code. This hangs until I send a SIGQUIT from my terminal with Control-\

$ go run ${GOPATH}/src/gopkg.in/src-d/go-git.v4/_examples/push/main.go test  # this hangs until I send a SIGQUIT from the terminal
git push
^\SIGQUIT: quit
PC=0x105631b m=0 sigcode=0

goroutine 0 [idle]:
runtime.mach_semaphore_wait(0xf03, 0x7fff00000000, 0x1022043, 0x1583cc0, 0x9c, 0x157f1e0, 0x7fff5fbff7b0, 0x1050b13, 0xffffffffffffffff, 0x7fff00000000, ...)
  /usr/local/go/src/runtime/sys_darwin_amd64.s:415 +0xb
runtime.semasleep1(0xffffffffffffffff, 0x7fff00000000)
  /usr/local/go/src/runtime/os_darwin.go:413 +0x4b
runtime.semasleep.func1()
  /usr/local/go/src/runtime/os_darwin.go:432 +0x33
runtime.systemstack(0x7fff5fbff7d8)
  /usr/local/go/src/runtime/asm_amd64.s:343 +0xab
runtime.semasleep(0xffffffffffffffff, 0x0)
  /usr/local/go/src/runtime/os_darwin.go:433 +0x4d
runtime.notesleep(0x157f650)
  /usr/local/go/src/runtime/lock_sema.go:166 +0xb2
runtime.stopm()
  /usr/local/go/src/runtime/proc.go:1650 +0xad
runtime.findrunnable(0xc42001b300, 0x0)
  /usr/local/go/src/runtime/proc.go:2102 +0x2e4
runtime.schedule()
  /usr/local/go/src/runtime/proc.go:2222 +0x14c
runtime.park_m(0xc420000340)
  /usr/local/go/src/runtime/proc.go:2285 +0xab
runtime.mcall(0x7fff5fbff9b0)
  /usr/local/go/src/runtime/asm_amd64.s:269 +0x5b

goroutine 1 [chan receive]:
golang.org/x/crypto/ssh.(*Session).Wait(0xc420186000, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/session.go:383 +0x6d
gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common.(*session).ReceivePack(0xc420192000, 0xc420012280, 0xc420082048, 0x2600000, 0xc4200c91d0)
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common/common.go:281 +0x17e
gopkg.in/src-d/go-git%2ev4.pushHashes(0x1549f00, 0xc420192000, 0x2600000, 0xc4200c91d0, 0xc420012280, 0xc4200cc500, 0x1d, 0x20, 0xc4200cc500, 0x1d, ...)
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/remote.go:570 +0x1cd
gopkg.in/src-d/go-git%2ev4.(*Remote).Push(0xc420136320, 0xc4200d7f40, 0x6, 0xc420136320)
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/remote.go:113 +0x52f
gopkg.in/src-d/go-git%2ev4.(*Repository).Push(0xc4201322a0, 0xc4200d7f40, 0x0, 0x0)
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/repository.go:664 +0x9d
main.main()
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/_examples/push/main.go:21 +0x120

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
  /usr/local/go/src/runtime/asm_amd64.s:2197 +0x1

goroutine 36 [IO wait]:
net.runtime_pollWait(0x16b7050, 0x72, 0x8)
  /usr/local/go/src/runtime/netpoll.go:164 +0x59
net.(*pollDesc).wait(0xc420158998, 0x72, 0x1546ec0, 0x15433e8)
  /usr/local/go/src/net/fd_poll_runtime.go:75 +0x38
net.(*pollDesc).waitRead(0xc420158998, 0xc420164000, 0x1000)
  /usr/local/go/src/net/fd_poll_runtime.go:80 +0x34
net.(*netFD).Read(0xc420158930, 0xc420164000, 0x1000, 0x1000, 0x0, 0x1546ec0, 0x15433e8)
  /usr/local/go/src/net/fd_unix.go:250 +0x1b7
net.(*conn).Read(0xc4200821c8, 0xc420164000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
  /usr/local/go/src/net/net.go:181 +0x70
bufio.(*Reader).Read(0xc4200731a0, 0xc42009b9a1, 0x5, 0x5, 0x0, 0x0, 0x3000000000000)
  /usr/local/go/src/bufio/bufio.go:213 +0x312
io.ReadAtLeast(0x1544880, 0xc4200731a0, 0xc42009b9a1, 0x5, 0x5, 0x5, 0x20, 0x20, 0x100000000000020)
  /usr/local/go/src/io/io.go:307 +0xa9
io.ReadFull(0x1544880, 0xc4200731a0, 0xc42009b9a1, 0x5, 0x5, 0x0, 0x1, 0x0)
  /usr/local/go/src/io/io.go:325 +0x58
golang.org/x/crypto/ssh.(*streamPacketCipher).readPacket(0xc42009b980, 0xc400000010, 0x1544880, 0xc4200731a0, 0xd, 0xd, 0x24b, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/cipher.go:150 +0x7c
golang.org/x/crypto/ssh.(*connectionState).readPacket(0xc420154b40, 0xc4200731a0, 0xc42016afb0, 0xd, 0xd, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/transport.go:129 +0x68
golang.org/x/crypto/ssh.(*transport).readPacket(0xc420154b40, 0xc42017e1f0, 0xd, 0xd, 0xc420073318, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/transport.go:113 +0x37
golang.org/x/crypto/ssh.(*handshakeTransport).readOnePacket(0xc4200d89a0, 0xc420073200, 0xc42016afb0, 0xd, 0xd, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/handshake.go:368 +0x48
golang.org/x/crypto/ssh.(*handshakeTransport).readLoop(0xc4200d89a0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/handshake.go:191 +0x38
created by golang.org/x/crypto/ssh.newClientTransport
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/handshake.go:128 +0x183

goroutine 37 [select]:
golang.org/x/crypto/ssh.(*handshakeTransport).kexLoop(0xc4200d89a0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/handshake.go:262 +0x823
created by golang.org/x/crypto/ssh.newClientTransport
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/handshake.go:129 +0x1a5

goroutine 38 [chan receive]:
golang.org/x/crypto/ssh.(*handshakeTransport).readPacket(0xc4200d89a0, 0xc42017e1f0, 0xd, 0xd, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/handshake.go:181 +0x64
golang.org/x/crypto/ssh.(*mux).onePacket(0xc420158a10, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/mux.go:215 +0x37
golang.org/x/crypto/ssh.(*mux).loop(0xc420158a10)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/mux.go:190 +0x43
created by golang.org/x/crypto/ssh.newMux
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/mux.go:128 +0x1a3

goroutine 39 [chan receive]:
golang.org/x/crypto/ssh.(*Client).handleGlobalRequests(0xc420157240, 0xc4200736e0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/client.go:137 +0x4e
created by golang.org/x/crypto/ssh.NewClient
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/client.go:56 +0xd7

goroutine 40 [chan receive]:
golang.org/x/crypto/ssh.(*Client).handleChannelOpens(0xc420157240, 0xc420073620)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/client.go:146 +0x68
created by golang.org/x/crypto/ssh.NewClient
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/client.go:57 +0x103

goroutine 41 [semacquire]:
sync.runtime_notifyListWait(0xc420157210, 0xc400000000)
  /usr/local/go/src/runtime/sema.go:297 +0x10b
sync.(*Cond).Wait(0xc420157200)
  /usr/local/go/src/sync/cond.go:57 +0x89
golang.org/x/crypto/ssh.(*mux).Wait(0xc420158a10, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/mux.go:110 +0x9c
golang.org/x/crypto/ssh.NewClient.func1(0xc420157240)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/client.go:59 +0x33
created by golang.org/x/crypto/ssh.NewClient
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/client.go:61 +0x125

goroutine 42 [chan receive]:
golang.org/x/crypto/ssh.(*forwardList).handleChannels(0xc420157250, 0xc420073740)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/tcpip.go:186 +0x71
created by golang.org/x/crypto/ssh.NewClient
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/client.go:62 +0x17d

goroutine 43 [chan receive]:
golang.org/x/crypto/ssh.(*forwardList).handleChannels(0xc420157250, 0xc4200737a0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/tcpip.go:186 +0x71
created by golang.org/x/crypto/ssh.NewClient
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/client.go:63 +0x1cc

goroutine 50 [chan receive]:
golang.org/x/crypto/ssh.(*Session).wait(0xc420186000, 0xc420073800, 0x12c7b2f, 0x180001)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/session.go:403 +0x90
golang.org/x/crypto/ssh.newSession.func1(0xc420186000, 0xc420073800)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/session.go:573 +0x35
created by golang.org/x/crypto/ssh.newSession
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/session.go:574 +0xc3

goroutine 51 [semacquire]:
sync.runtime_notifyListWait(0xc420157310, 0xc400000000)
  /usr/local/go/src/runtime/sema.go:297 +0x10b
sync.(*Cond).Wait(0xc420157300)
  /usr/local/go/src/sync/cond.go:57 +0x89
golang.org/x/crypto/ssh.(*buffer).Read(0xc420160960, 0xc420194000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/buffer.go:95 +0x137
golang.org/x/crypto/ssh.(*channel).ReadExtended(0xc4200f0480, 0xc420194000, 0x1000, 0x1000, 0x1, 0x0, 0x0, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/channel.go:349 +0x75
golang.org/x/crypto/ssh.(*extChannel).Read(0xc42017e040, 0xc420194000, 0x1000, 0x1000, 0x1000, 0x1000, 0x0)
  /Users/orawlings/go/src/golang.org/x/crypto/ssh/channel.go:488 +0x53
bufio.(*Scanner).Scan(0xc42003df38, 0x0)
  /usr/local/go/src/bufio/scan.go:207 +0x294
gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common.(*client).listenErrors.func1(0x22a0050, 0xc42017e040, 0xc4201880c0)
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common/common.go:150 +0x87
created by gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common.(*client).listenErrors
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/plumbing/transport/internal/common/common.go:154 +0x7f

goroutine 8 [chan send]:
gopkg.in/src-d/go-git%2ev4.pushHashes.func1(0xc420082048, 0x2600000, 0xc4200c91d0, 0xc4200cc500, 0x1d, 0x20, 0xc420188720)
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/remote.go:567 +0x144
created by gopkg.in/src-d/go-git%2ev4.pushHashes
  /Users/orawlings/go/src/gopkg.in/src-d/go-git.v4/remote.go:568 +0x1a6

rax    0xe
rbx    0x157f540
rcx    0x7fff5fbff750
rdx    0x7fff5fbff7d8
rdi    0xf03
rsi    0x1
rbp    0x7fff5fbff788
rsp    0x7fff5fbff750
r8     0x0
r9     0xc42001b4b0
r10    0x0
r11    0x286
r12    0x13d0638
r13    0xc4201b1aac
r14    0x1002e10
r15    0xa8f67d3b
rip    0x105631b
rflags 0x286
cs     0x7
fs     0x0
gs     0x0
exit status 2

The change has been successfully received in github, and we can demonstrate that by reattempting to push the same commit:

$ go run ${GOPATH}/src/gopkg.in/src-d/go-git.v4/_examples/push/main.go test
git push
error: already up-to-date
exit status 1

Some information on the exact version of gopkg.in/src-d/go-git.v4 that I have installed locally:

$ git -C ${GOPATH}/src/gopkg.in/src-d/go-git.v4 log -1 HEAD
commit 7e249dfcf28765939bde8f38784b3274b522f880
Merge: f663a93 f369a78
Author: Santiago M. Mola <[email protected]>
Date:   Wed May 24 11:42:54 2017 +0200

    Merge pull request #400 from ajnavarro/improvement/diff-delta
    
    format/packfile: improve binary delta algorithm

Some information on my local git version, go version, and go env:

$ git version
git version 2.11.0 (Apple Git-81)
$ go version
go version go1.8 darwin/amd64
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/orawlings/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/__/1bnpyd4d7t31wkxd9vmk2sz9985fpv/T/go-build798604299=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
@orirawlings
Copy link
Contributor Author

Looks like this is a duplicate of #310 and was fixed in master with #418

Seems like #418 isn't in the v4 branch yet, which is why I'm experiencing the problem.

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

2 participants