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

[WIP] Set JSON headers only if one of body or result is non-nil. #320

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timoreimann
Copy link
Collaborator

This allows Ping() to work in Marathon 1.4.4+.

Needs more testing to guarantee no other functions got broken.

This allows Ping() to work in Marathon 1.4.4+.
@timoreimann
Copy link
Collaborator Author

Looks like the test server is stuck waiting for connections to finish:

--- PASS: TestUtilsTrimRootPath (0.00s)
=== RUN   TestParseIPAddr
--- PASS: TestParseIPAddr (0.00s)
PASS
ok  	github.com/gambol99/go-marathon	6.003s
make[1]: Entering directory `/home/travis/gopath/src/github.com/gambol99/go-marathon'
--> Running go tool vet -asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr .
make[1]: Leaving directory `/home/travis/gopath/src/github.com/gambol99/go-marathon'
make[1]: Entering directory `/home/travis/gopath/src/github.com/gambol99/go-marathon'
--> Running go test --cover
2017/08/27 00:42:31 httptest.Server blocked in Close after 5 seconds, waiting for connections:
  *net.TCPConn 0xc820178548 127.0.0.1:47108 in state active
SIGQUIT: quit
PC=0x4625e1 m=0
goroutine 0 [idle]:
runtime.futex(0xb61768, 0x0, 0x0, 0x0, 0x0, 0xb60d10, 0x0, 0x0, 0x4111f4, 0xb61768, ...)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/sys_linux_amd64.s:302 +0x21
runtime.futexsleep(0xb61768, 0x0, 0xffffffffffffffff)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/os1_linux.go:40 +0x53
runtime.notesleep(0xb61768)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/lock_futex.go:145 +0xa4
runtime.stopm()
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:1535 +0x10b
runtime.findrunnable(0xc820027500, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:1973 +0x739
runtime.schedule()
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:2072 +0x24f
runtime.park_m(0xc8203ba900)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/proc.go:2137 +0x18b
runtime.mcall(0x7fff8e40c950)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:233 +0x5b
goroutine 1 [chan receive, 8 minutes]:
testing.RunTests(0x9dd7f0, 0xb5ea40, 0x74, 0x74, 0xc8200d6701)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/testing/testing.go:583 +0x8d2
testing.(*M).Run(0xc820429f08, 0xb60940)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/testing/testing.go:515 +0x81
main.main()
	github.com/gambol99/go-marathon/_test/_testmain.go:372 +0x253
goroutine 17 [syscall, 8 minutes, locked to thread]:
runtime.goexit()
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/asm_amd64.s:1998 +0x1
goroutine 545 [semacquire, 8 minutes]:
sync.runtime_Semacquire(0xc82040d3bc)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/sema.go:47 +0x26
sync.(*WaitGroup).Wait(0xc82040d3b0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/sync/waitgroup.go:127 +0xb4
net/http/httptest.(*Server).Close(0xc82040d380)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/httptest/server.go:189 +0x25d
github.com/gambol99/go-marathon.(*fakeServer).Close(0xc82040d3f0)
	/home/travis/gopath/src/github.com/gambol99/go-marathon/testing_utils_test.go:318 +0x37
github.com/gambol99/go-marathon.(*endpoint).Close(0xc82040d3e0)
	/home/travis/gopath/src/github.com/gambol99/go-marathon/testing_utils_test.go:322 +0x2d
github.com/gambol99/go-marathon.TestRegisterSEESubscriptionReconnectsStreamOnError(0xc820406750)
	/home/travis/gopath/src/github.com/gambol99/go-marathon/subscription_test.go:425 +0x525
testing.tRunner(0xc820406750, 0xb5f328)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/testing/testing.go:473 +0x98
created by testing.RunTests
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/testing/testing.go:582 +0x892
goroutine 199 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc82021e900, 0xc82024cfe0)
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:142 +0xbb
created by github.com/gambol99/go-marathon.(*cluster).markDown
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:130 +0x17b
goroutine 540 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc8203ee580, 0xc8203eb740)
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:142 +0xbb
created by github.com/gambol99/go-marathon.(*cluster).markDown
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:130 +0x17b
goroutine 544 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc8203ee580, 0xc8203eb800)
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:142 +0xbb
created by github.com/gambol99/go-marathon.(*cluster).markDown
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:130 +0x17b
goroutine 546 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc8202e55c0, 0xc8203fe1e0)
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:142 +0xbb
created by github.com/gambol99/go-marathon.(*cluster).markDown
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:130 +0x17b
goroutine 552 [chan send, 8 minutes]:
github.com/donovanhide/eventsource.(*Server).Handler.func1(0x2b388aa66ef0, 0xc8204161a0, 0xc8204021c0)
	/home/travis/gopath/src/github.com/donovanhide/eventsource/server.go:87 +0x378
github.com/gambol99/go-marathon.authMiddleware.func1(0x2b388aa66ef0, 0xc8204161a0, 0xc8204021c0)
	/home/travis/gopath/src/github.com/gambol99/go-marathon/testing_utils_test.go:254 +0x1ce
net/http.HandlerFunc.ServeHTTP(0xc820410630, 0x2b388aa66ef0, 0xc8204161a0, 0xc8204021c0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/server.go:1618 +0x3a
net/http.(*ServeMux).ServeHTTP(0xc820410600, 0x2b388aa66ef0, 0xc8204161a0, 0xc8204021c0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/server.go:1910 +0x17d
net/http.serverHandler.ServeHTTP(0xc8203c3500, 0x2b388aa66ef0, 0xc8204161a0, 0xc8204021c0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/server.go:2081 +0x19e
net/http.(*conn).serve(0xc820400200)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/server.go:1472 +0xf2e
created by net/http.(*Server).Serve
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/server.go:2137 +0x44e
goroutine 542 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc8203ee580, 0xc8203eb7a0)
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:142 +0xbb
created by github.com/gambol99/go-marathon.(*cluster).markDown
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:130 +0x17b
goroutine 517 [chan receive]:
github.com/gambol99/go-marathon.(*marathonClient).registerSSESubscription.func1(0xc8203c42d0)
	github.com/gambol99/go-marathon/_test/_obj_test/subscription.go:194 +0x17d
created by github.com/gambol99/go-marathon.(*marathonClient).registerSSESubscription
	github.com/gambol99/go-marathon/_test/_obj_test/subscription.go:202 +0x64
goroutine 564 [select, 8 minutes]:
github.com/donovanhide/eventsource.(*Server).run(0xc8203f2cb0)
	/home/travis/gopath/src/github.com/donovanhide/eventsource/server.go:140 +0x90b
created by github.com/donovanhide/eventsource.NewServer
	/home/travis/gopath/src/github.com/donovanhide/eventsource/server.go:50 +0x1b1
goroutine 531 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc82036dd00, 0xc8203ab780)
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:142 +0xbb
created by github.com/gambol99/go-marathon.(*cluster).markDown
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:130 +0x17b
goroutine 529 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc82036dd00, 0xc8203ab720)
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:142 +0xbb
created by github.com/gambol99/go-marathon.(*cluster).markDown
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:130 +0x17b
goroutine 550 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc82036dd00, 0xc8203ab7e0)
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:142 +0xbb
created by github.com/gambol99/go-marathon.(*cluster).markDown
	github.com/gambol99/go-marathon/_test/_obj_test/cluster.go:130 +0x17b
goroutine 565 [IO wait, 8 minutes]:
net.runtime_pollWait(0x2b388aa666e8, 0x72, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8203f2df0, 0x72, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8203f2df0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc8203f2d90, 0x0, 0x2b388aaa1000, 0xc8204140c0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/fd_unix.go:426 +0x27c
net.(*TCPListener).AcceptTCP(0xc8200332f0, 0x1, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc8200332f0, 0x0, 0x0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/tcpsock_posix.go:264 +0x3d
net/http.(*Server).Serve(0xc8203c3780, 0x2b388aa65a40, 0xc8200332f0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/server.go:2117 +0x129
net/http/httptest.(*Server).goServe.func1(0xc82040d620)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/httptest/server.go:237 +0x75
created by net/http/httptest.(*Server).goServe
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/httptest/server.go:238 +0x58
goroutine 566 [select, 8 minutes]:
net/http.(*persistConn).roundTrip(0xc820416000, 0xc8203f4d10, 0x0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/transport.go:1469 +0xf1f
net/http.(*Transport).RoundTrip(0xc8200baf00, 0xc8203bf6c0, 0xc8200baf00, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/transport.go:320 +0x9bb
net/http.send(0xc8203bf6c0, 0x2b388aa65820, 0xc8200baf00, 0x0, 0x0, 0x0, 0xc8203ebfe0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/client.go:260 +0x6b7
net/http.(*Client).send(0xc820410990, 0xc8203bf6c0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/client.go:155 +0x185
net/http.(*Client).doFollowingRedirects(0xc820410990, 0xc8203bf6c0, 0x9ddb70, 0x0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/client.go:475 +0x8a4
net/http.(*Client).Do(0xc820410990, 0xc8203bf6c0, 0x6, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/client.go:188 +0xff
github.com/donovanhide/eventsource.(*Stream).connect(0xc82040d860, 0x0, 0x0, 0x0, 0x0)
	/home/travis/gopath/src/github.com/donovanhide/eventsource/stream.go:127 +0x129
github.com/donovanhide/eventsource.SubscribeWith(0x0, 0x0, 0xc820410990, 0xc8203bf6c0, 0x9, 0x0, 0x0)
	/home/travis/gopath/src/github.com/donovanhide/eventsource/stream.go:75 +0x16e
github.com/gambol99/go-marathon.(*marathonClient).connectToSSE(0xc8203c45a0, 0x4, 0x0, 0x0)
	github.com/gambol99/go-marathon/_test/_obj_test/subscription.go:236 +0x44e
github.com/gambol99/go-marathon.(*marathonClient).registerSSESubscription.func1(0xc8203c45a0)
	github.com/gambol99/go-marathon/_test/_obj_test/subscription.go:190 +0x56
created by github.com/gambol99/go-marathon.(*marathonClient).registerSSESubscription
	github.com/gambol99/go-marathon/_test/_obj_test/subscription.go:202 +0x64
goroutine 568 [IO wait, 8 minutes]:
net.runtime_pollWait(0x2b388aa663e8, 0x72, 0xc820418000)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc8203f3020, 0x72, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc8203f3020, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc8203f2fc0, 0xc820418000, 0x1000, 0x1000, 0x0, 0x2b388aa61050, 0xc82000a270)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc820033300, 0xc820418000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x2b388aa66cd0, 0xc820033300, 0xc820416068, 0xc820418000, 0x1000, 0x1000, 0x60, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/transport.go:1683 +0x67
net/http.(*noteEOFReader).Read(0xc820414120, 0xc820418000, 0x1000, 0x1000, 0x7cdf20, 0x0, 0x0)
	<autogenerated>:284 +0xd0
bufio.(*Reader).fill(0xc82040db60)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).Peek(0xc82040db60, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/bufio/bufio.go:132 +0xcc
net/http.(*persistConn).readLoop(0xc820416000)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/transport.go:1069 +0x177
created by net/http.(*Transport).dialConn
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/transport.go:853 +0x10a6
goroutine 569 [select, 8 minutes]:
net/http.(*persistConn).writeLoop(0xc820416000)
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/transport.go:1273 +0x472
created by net/http.(*Transport).dialConn
	/home/travis/.gimme/versions/go1.6.linux.amd64/src/net/http/transport.go:854 +0x10cb
rax    0xca
rbx    0x0
rcx    0x4625e3
rdx    0x0
rdi    0xb61768
rsi    0x0
rbp    0x1
rsp    0x7fff8e40c7b0
r8     0x0
r9     0x0
r10    0x0
r11    0x286
r12    0x6
r13    0x9dbbb0
r14    0x3
r15    0x8
rip    0x4625e1
rflags 0x286
cs     0x33
fs     0x0
gs     0x0
*** Test killed with quit: ran too long (10m0s).
FAIL	github.com/gambol99/go-marathon	600.007s
make[1]: *** [cover] Error 1
make[1]: Leaving directory `/home/travis/gopath/src/github.com/gambol99/go-marathon'
make: *** [test] Error 2

Some goroutines are pending in markDown -- I guess we finally need to support stopping health checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant