cli icon indicating copy to clipboard operation
cli copied to clipboard

cf push panic: sync: negative WaitGroup counter

Open markstgodard opened this issue 10 years ago • 12 comments

When I pushed dora I randomly got this error. panic: sync: negative WaitGroup counter

Cannot reproduce, but looks like when I did push, it had problems connecting to get the logs, so likely related:

timeout connecting to log server, no log will be shown

Command

cf push dora -m 256m

CLI Version

cf version 6.18.0+b22884b-2016-05-10

Error

cf push dora -m 256m
Creating app dora in org o / space s as admin...
OK

Using route dora.bosh-lite.com
Binding dora.bosh-lite.com to dora...
OK

Uploading dora...
Uploading app files from: /Users/mark/workspace/cf-release/src/github.com/cloudfoundry/cf-acceptance-tests/assets/dora
Uploading 182.9K, 37 files
Done uploading
OK

timeout connecting to log server, no log will be shown
Starting app dora in org o / space s as admin...
panic: sync: negative WaitGroup counter

Stack Trace


Starting app dora in org o / space s as admin...
panic: sync: negative WaitGroup counter

goroutine 550 [running]:
panic(0x74aa80, 0xc8202ce780)
    /usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6
sync.(*WaitGroup).Add(0xc8202c6e10, 0xffffffffffffffff)
    /usr/local/Cellar/go/1.6.2/libexec/src/sync/waitgroup.go:71 +0xd0
sync.(*WaitGroup).Done(0xc8202c6e10)
    /usr/local/Cellar/go/1.6.2/libexec/src/sync/waitgroup.go:96 +0x2a
github.com/cloudfoundry/cli/cf/commands/application.(*Start).tailStagingLogs.func1()
    /Users/cffadmin/concourse-work-dir/containers/00002kcgp52/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/cf/commands/application/start.go:226 +0x27
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).retryAction.func1()
    /Users/cffadmin/concourse-work-dir/containers/00002kcgp52/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:238 +0x2d
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).establishWebsocketConnection(0xc8200ee600, 0xc820cd6700, 0x31, 0xc8209dcd80, 0x465, 0x40000000, 0x0, 0x0)
    /Users/cffadmin/concourse-work-dir/containers/00002kcgp52/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:285 +0x722
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).listenAction.func1(0x0, 0x0, 0xc8200ee600)
    /Users/cffadmin/concourse-work-dir/containers/00002kcgp52/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:220 +0xe7
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).retryAction(0xc8200ee600, 0xc820cd6740, 0xc8203b2900, 0x5)
    /Users/cffadmin/concourse-work-dir/containers/00002kcgp52/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:243 +0x10d
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).streamAppDataTo(0xc8200ee600, 0xc820297880, 0xc8204e6f90, 0x24, 0xc8209dcd80, 0x465, 0xc820282ea0, 0xc8203b2900, 0x5)
    /Users/cffadmin/concourse-work-dir/containers/00002kcgp52/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:164 +0x19f
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).tailingLogs.func2(0xc8203b2900, 0xc8203b28a0, 0xc8200ee600, 0xc820297880, 0xc8204e6f90, 0x24, 0xc8209dcd80, 0x465, 0xc820282ea0, 0x5)
    /Users/cffadmin/concourse-work-dir/containers/00002kcgp52/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:140 +0xd3
created by github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).tailingLogs
    /Users/cffadmin/concourse-work-dir/containers/00002kcgp52/tmp/build/254d4083/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:141 +0x13e

CC API Endpoint Version

API endpoint: https://api.bosh-lite.com (API version: 2.56.0)

Platform Details

Mac OS X

Shell

zsh

markstgodard avatar May 27 '16 20:05 markstgodard

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/120467051

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar May 27 '16 20:05 cf-gitbot

@markstgodard Looks like you found a super rare race condition. Thanks!

challiwill avatar Jun 01 '16 15:06 challiwill

We believe that the connection is made concurrently, or immediately after the timeout is issued, but before the function returns. (https://github.com/cloudfoundry/cli/blob/c345a83c3d7f57096137a26b795b18d50bca8924/cf/commands/application/start.go#L241-L245 and https://github.com/cloudfoundry/cli/blob/c345a83c3d7f57096137a26b795b18d50bca8924/cf/commands/application/start.go#L224-L227)

challiwill avatar Jun 01 '16 15:06 challiwill

We have fixed this in cf CLI 6.19.0, released today. https://github.com/cloudfoundry/cli#downloads

Regards, Dies Koper CF CLI PM

dkoper avatar Jun 09 '16 01:06 dkoper

We still see the issue with 6.19.0+b29b4e0-2016-06-08 in one of our CF landscapes. It is also reproducible (happens repeatedly). All our other Cloud Foundry landscapes run fine with 6.19 though. So, I am not sure whether it's only a rare race condition.

vlerenc avatar Jun 15 '16 06:06 vlerenc

@vlerenc if I understand what you are saying, in one of your environments this error still occurs sometimes, but not all the time. Is that correct?

Is there any way that this environment is different from the other environments?

challiwill avatar Jun 15 '16 17:06 challiwill

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/121603685

The labels on this github issue will be updated when the story is started.

cf-gitbot avatar Jun 15 '16 17:06 cf-gitbot

@challiwill Actually, in one it happens now all the time (when trying to push an app) while in others we see no issues. All have 6.19.0.

vlerenc avatar Jun 15 '16 20:06 vlerenc

Hi @vlerenc

Could you submit an updated trace please? Also your app manifest file (if you're using one) with any secret info redacted?

Cheers, Dies Koper CF CLI PM

dkoper avatar Jun 16 '16 22:06 dkoper

Sure, before the error, there is also a warning that I don't get with 6.18 (I see it only with 6.19), maybe the source of the problem and the reason why it's 100 % reproducible in that landscape?:

Warning: error tailing logs
Error dialing traffic controller server: read tcp 10.0.0.11:37839->**.**.**.**:443: i/o timeout.
Please ask your Cloud Foundry Operator to check the platform configuration (traffic controller is wss://doppler.cf.*****************:443).
Starting app redis-app in org test / space containers as admin...
panic: sync: negative WaitGroup counter

goroutine 918 [running]:
panic(0xb5cc20, 0xc8204d8880)
    /usr/local/go/src/runtime/panic.go:481 +0x3e6
sync.(*WaitGroup).Add(0xc8203a8310, 0xffffffffffffffff)
    /usr/local/go/src/sync/waitgroup.go:71 +0xd0
sync.(*WaitGroup).Done(0xc8203a8310)
    /usr/local/go/src/sync/waitgroup.go:96 +0x2a
github.com/cloudfoundry/cli/cf/commands/application.(*Start).TailStagingLogs.func1()
    /tmp/build/80754af9/gopath/src/github.com/cloudfoundry/cli/cf/commands/application/start.go:245 +0x34
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).retryAction.func1()
    /tmp/build/80754af9/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:238 +0x2d
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).establishWebsocketConnection(0xc8200c6900, 0xc8203b7c80, 0x31, 0xc820c10f00, 0x4d8, 0x5, 0x0, 0x0)
    /tmp/build/80754af9/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:285 +0x722
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).listenAction.func1(0x0, 0x0, 0xc8204a9e38)
    /tmp/build/80754af9/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:220 +0xe7
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).retryAction(0xc8200c6900, 0xc8203b7f80, 0xc82023f800, 0x5)
    /tmp/build/80754af9/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:243 +0x10d
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).streamAppDataTo(0xc8200c6900, 0xc820362c00, 0xc820444750, 0x24, 0xc820c10f00, 0x4d8, 0xc8203a8350, 0xc82023f800, 0x5)
    /tmp/build/80754af9/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:164 +0x19f
github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).tailingLogs.func2(0xc82023f800, 0xc82023f7a0, 0xc8200c6900, 0xc820362c00, 0xc820444750, 0x24, 0xc820c10f00, 0x4d8, 0xc8203a8350, 0x5)
    /tmp/build/80754af9/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:140 +0xd3
created by github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer.(*Consumer).tailingLogs
    /tmp/build/80754af9/gopath/src/github.com/cloudfoundry/cli/vendor/github.com/cloudfoundry/noaa/consumer/async.go:141 +0x13e

And the manifest is that of a test app, minimal:

applications:
- name: redis-app
  command: node server.js
  memory: 256M
  instances: 1
  host: redis-app
  path: .
  services:
  - redis-service

vlerenc avatar Jun 17 '16 03:06 vlerenc

@vlerenc We believe we have fixed this issue. Can you please try the appropriate edge binary and let us know. Thanks!

n4wei avatar Jun 28 '16 23:06 n4wei

We believe this has now been fixed in cf CLI 6.20.0. https://github.com/cloudfoundry/cli#downloads

dkoper avatar Jun 30 '16 00:06 dkoper