Skip to content

cmd/go: panic running go mod tidy #27119

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

Closed
rogpeppe opened this issue Aug 21, 2018 · 5 comments
Closed

cmd/go: panic running go mod tidy #27119

rogpeppe opened this issue Aug 21, 2018 · 5 comments

Comments

@rogpeppe
Copy link
Contributor

go version go1.11rc1 linux/amd64

% cd /tmp
% git clone git@github.com:rogpeppe/misc
Cloning into 'misc'...
% cd misc/cmd/juju-watchall
% go mod init github.com/rogpeppe/misc/cmd/juju-watchall
go: creating new go.mod: module github.com/rogpeppe/misc/cmd/juju-watchall
go: copying requirements from dependencies.tsv
% go mod tidy
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
cmd/go/internal/modload.(*mvsReqs).required(0xc0000ca7e0, 0xc000028d50, 0x2a, 0x0, 0x0, 0xc0001454f8, 0x40f779, 0x8e8b60, 0xc0009025b8, 0xc000145598)
	/home/rog/go/src/cmd/go/internal/modload/load.go:835 +0x1232
cmd/go/internal/modload.(*mvsReqs).Required.func1(0xc0005fe484, 0x914000)
	/home/rog/go/src/cmd/go/internal/modload/load.go:765 +0x83
cmd/go/internal/par.(*Cache).Do(0xc0000ca7f8, 0x914000, 0xc0005fe440, 0xc000145708, 0xc0001458d0, 0xc000145810)
	/home/rog/go/src/cmd/go/internal/par/work.go:128 +0xd6
cmd/go/internal/modload.(*mvsReqs).Required(0xc0000ca7e0, 0xc000028d50, 0x2a, 0x0, 0x0, 0xc0000ca7e0, 0x70, 0x68, 0x925c80, 0x5555555555555555)
	/home/rog/go/src/cmd/go/internal/modload/load.go:764 +0x10f
cmd/go/internal/modcmd.modTidyGoSum.func1(0xc000028d50, 0x2a, 0x0, 0x0)
	/home/rog/go/src/cmd/go/internal/modcmd/tidy.go:80 +0x10b
cmd/go/internal/modcmd.modTidyGoSum()
	/home/rog/go/src/cmd/go/internal/modcmd/tidy.go:87 +0x164
cmd/go/internal/modcmd.runTidy(0xd56040, 0xc0000a2080, 0x0, 0x0)
	/home/rog/go/src/cmd/go/internal/modcmd/tidy.go:66 +0x513
main.main()
	/home/rog/go/src/cmd/go/main.go:218 +0x7d4
@mvdan
Copy link
Member

mvdan commented Aug 21, 2018

I fail to reproduce the crash on go version devel +e7f59f0284 Tue Aug 21 08:12:06 2018 +0000 linux/amd64. Followed the steps precisely, which took quite a while as my cache wasn't full of juju/canonical stuff.

@mvdan
Copy link
Member

mvdan commented Aug 21, 2018

For completeness - here's my output:

$ go mod tidy
go: finding github.com/juju/rfc v0.0.0-20160711024213-ebdbbdb950cd
go: finding github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af
go: finding github.com/juju/utils v0.0.0-20171025121855-0be7bba17076
go: finding github.com/juju/errors v0.0.0-20150916125642-1b5e39b83d18
go: finding github.com/juju/gojsonreference v0.0.0-20150204194633-f0d24ac5ee33
go: finding github.com/rogpeppe/rjson v0.0.0-20151026200957-77220b71d327
go: finding github.com/juju/webbrowser v0.0.0-20160309143629-54b8c57083b4
go: finding github.com/juju/version v0.0.0-20161031051906-1f41e27e54f2
go: finding github.com/juju/juju v0.0.0-20171025161712-abaa606f0412
go: finding github.com/lestrrat/go-jsschema v0.0.0-20160903131957-b09d7650b822
go: finding github.com/dustin/go-humanize v0.0.0-20141228071148-145fabdb1ab7
go: finding github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6
go: finding github.com/juju/cmd v0.0.0-20170413021306-e47739aefe0a
go: finding github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c
go: finding github.com/juju/ansiterm v0.0.0-20160907234532-b99631de12cf
go: finding github.com/juju/persistent-cookiejar v0.0.0-20170428161559-d67418f14c93
go: finding github.com/juju/txn v0.0.0-20170613234454-dbb63c620814
go: finding github.com/mattn/go-colorable v0.0.6
go: finding golang.org/x/text v0.0.0-20160726164857-2910a502d2bf
go: finding github.com/juju/schema v0.0.0-20160420044203-075de04f9b7d
go: finding github.com/julienschmidt/httprouter v0.0.0-20151013225520-77a895ad01eb
go: finding github.com/juju/loggo v0.0.0-20170605014607-8232ab8918d9
go: finding github.com/juju/mutex v0.0.0-20160617010907-59c26ee16344
go: finding golang.org/x/sys v0.0.0-20170201051245-7a6e5648d140
go: finding github.com/gorilla/websocket v0.0.0-20170214174118-804cb600d06b
go: finding github.com/lestrrat/go-jspointer v0.0.0-20160229021354-f4881e611bdb
go: finding github.com/juju/gojsonschema v0.0.0-20150312170016-e1ad140384f2
go: finding github.com/lestrrat/go-structinfo v0.0.0-20160308131105-f74c056fe41f
go: finding gopkg.in/macaroon-bakery.v1 v1.0.0-20160622121421-469b44e6f1f9
go: finding github.com/lestrrat/go-jsval v0.0.0-20161012045717-b1258a10419f
go: finding github.com/juju/httpprof v0.0.0-20141217160036-14bf14c30767
go: finding github.com/juju/gojsonpointer v0.0.0-20150204194629-afe8b77aa08f
go: finding gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: finding gopkg.in/macaroon.v1 v1.0.0-20150121114231-ab3940c6c165
go: finding github.com/juju/go4 v0.0.0-20160222163258-40d72ab9641a
go: finding github.com/pkg/errors v0.0.0-20161002052512-839d9e913e06
go: finding gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531180850-df99d62fd42d
go: finding github.com/juju/replicaset v0.0.0-20170913040223-0072546a972e
go: finding github.com/lestrrat/go-pdebug v0.0.0-20160817063333-2e6eaaa5717f
go: finding github.com/juju/jsonschema v0.0.0-20161102181919-a0ef8b74ebcf
go: finding github.com/juju/httprequest v0.0.0-20161006150909-266fd1e9debf
go: finding gopkg.in/errgo.v1 v1.0.0-20161222125816-442357a80af5
go: finding github.com/coreos/go-systemd v0.0.0-20160202211425-7b2428fec400
go: finding github.com/lestrrat/go-jsref v0.0.0-20160601013240-e452c7b5801d
go: finding gopkg.in/juju/environschema.v1 v1.0.0-20151104115810-7359fc7857ab
go: finding gopkg.in/juju/worker.v1 v1.0.0-20170308002458-6965b9d82671
go: finding gopkg.in/retry.v1 v1.0.0-20170531091238-01631078ef2f
go: finding github.com/juju/description v0.0.0-20170913025336-7e21278b5648
go: finding github.com/juju/idmclient v0.0.0-20170209162749-4dc25171f675
go: finding github.com/godbus/dbus v0.0.0-20160506222550-32c6cc29c145
go: finding github.com/juju/usso v0.0.0-20160401104424-68a59c96c178
go: finding github.com/juju/gnuflag v0.0.0-20160809165214-4e76c5658185
go: finding gopkg.in/juju/names.v2 v2.0.0-20170814040430-73ecf03dfbe6
go: finding gopkg.in/juju/charmrepo.v2-unstable v2.0.0-20161117152528-e79aa298df89
go: finding golang.org/x/crypto v0.0.0-20170421043120-96846453c37f
go: finding gopkg.in/juju/blobstore.v2 v2.0.0-20160125023703-51fa6e26128d
go: finding gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4
go: finding gopkg.in/yaml.v2 v2.0.0-20170208141851-a3f3340b5840
go: finding gopkg.in/juju/charm.v6-unstable v6.0.0-20170728194100-514bb811b021
go: finding golang.org/x/net v0.0.0-20150829230318-ea47fc708ee3
go: downloading github.com/juju/juju v0.0.0-20171025161712-abaa606f0412
go: downloading github.com/rogpeppe/rjson v0.0.0-20151026200957-77220b71d327
go: finding github.com/rogpeppe/misc/jujuconn latest
go: downloading gopkg.in/juju/names.v2 v2.0.0-20170814040430-73ecf03dfbe6
go: downloading github.com/juju/errors v0.0.0-20150916125642-1b5e39b83d18
go: downloading gopkg.in/yaml.v2 v2.0.0-20170208141851-a3f3340b5840
go: downloading gopkg.in/mgo.v2 v2.0.0-20160818015218-f2b6f6c918c4
go: downloading github.com/juju/loggo v0.0.0-20170605014607-8232ab8918d9
go: downloading gopkg.in/juju/charm.v6-unstable v6.0.0-20170728194100-514bb811b021
go: downloading golang.org/x/crypto v0.0.0-20170421043120-96846453c37f
go: downloading gopkg.in/macaroon-bakery.v1 v1.0.0-20160622121421-469b44e6f1f9
go: downloading gopkg.in/macaroon.v1 v1.0.0-20150121114231-ab3940c6c165
go: downloading github.com/gorilla/websocket v0.0.0-20170214174118-804cb600d06b
go: downloading github.com/juju/utils v0.0.0-20171025121855-0be7bba17076
go: downloading github.com/juju/mutex v0.0.0-20160617010907-59c26ee16344
go: downloading github.com/juju/schema v0.0.0-20160420044203-075de04f9b7d
go: downloading gopkg.in/retry.v1 v1.0.0-20170531091238-01631078ef2f
go: downloading gopkg.in/juju/blobstore.v2 v2.0.0-20160125023703-51fa6e26128d
go: downloading gopkg.in/juju/worker.v1 v1.0.0-20170308002458-6965b9d82671
go: downloading github.com/juju/replicaset v0.0.0-20170913040223-0072546a972e
go: downloading github.com/juju/jsonschema v0.0.0-20161102181919-a0ef8b74ebcf
go: downloading github.com/juju/description v0.0.0-20170913025336-7e21278b5648
go: downloading github.com/juju/persistent-cookiejar v0.0.0-20170428161559-d67418f14c93
go: downloading golang.org/x/net v0.0.0-20150829230318-ea47fc708ee3
go: downloading github.com/julienschmidt/httprouter v0.0.0-20151013225520-77a895ad01eb
go: downloading github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading github.com/juju/httprequest v0.0.0-20161006150909-266fd1e9debf
go: downloading github.com/lestrrat/go-jsschema v0.0.0-20160903131957-b09d7650b822
go: downloading github.com/juju/gojsonschema v0.0.0-20150312170016-e1ad140384f2
go: downloading github.com/pkg/errors v0.0.0-20161002052512-839d9e913e06
go: downloading github.com/juju/cmd v0.0.0-20170413021306-e47739aefe0a
go: downloading gopkg.in/juju/charmrepo.v2-unstable v2.0.0-20161117152528-e79aa298df89
go: downloading github.com/coreos/go-systemd v0.0.0-20160202211425-7b2428fec400
go: downloading golang.org/x/sys v0.0.0-20170201051245-7a6e5648d140
go: downloading github.com/dustin/go-humanize v0.0.0-20141228071148-145fabdb1ab7
go: downloading github.com/juju/webbrowser v0.0.0-20160309143629-54b8c57083b4
go: downloading gopkg.in/errgo.v1 v1.0.0-20161222125816-442357a80af5
go: downloading github.com/juju/gnuflag v0.0.0-20160809165214-4e76c5658185
go: downloading github.com/juju/ansiterm v0.0.0-20160907234532-b99631de12cf
go: finding github.com/juju/testing/checkers latest
go: finding github.com/juju/testing latest
go: finding github.com/juju/testing/httptesting latest
go: finding github.com/juju/pubsub latest
go: finding gopkg.in/check.v1 latest
go: downloading github.com/lestrrat/go-jsval v0.0.0-20161012045717-b1258a10419f
go: downloading golang.org/x/text v0.0.0-20160726164857-2910a502d2bf
go: finding github.com/bmizerany/pat latest
go: finding github.com/prometheus/client_golang/prometheus latest
go: finding github.com/juju/ratelimit v1.0.1
go: finding github.com/gorilla/schema v1.0.2
go: finding gopkg.in/juju/charmstore.v5-unstable latest
go: downloading github.com/juju/pubsub v0.0.0-20180819205824-ad5dc02599e0
go: downloading github.com/juju/testing v0.0.0-20180820040200-b0b89ba330f2
go: downloading github.com/juju/txn v0.0.0-20170613234454-dbb63c620814
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0-20170531180850-df99d62fd42d
go: downloading github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40
go: downloading github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c
go: downloading github.com/juju/rfc v0.0.0-20160711024213-ebdbbdb950cd
go: downloading github.com/lestrrat/go-pdebug v0.0.0-20160817063333-2e6eaaa5717f
go: downloading gopkg.in/juju/environschema.v1 v1.0.0-20151104115810-7359fc7857ab
go: downloading github.com/juju/ratelimit v1.0.1
go: downloading github.com/juju/idmclient v0.0.0-20170209162749-4dc25171f675
go: downloading github.com/gorilla/schema v1.0.2
go: finding github.com/joyent/gosign/auth latest
go: finding github.com/juju/bundlechanges latest
go: finding github.com/rogpeppe/misc latest
go: downloading github.com/rogpeppe/misc v0.0.0-20180802101958-b0a2fa027b0b
go: finding github.com/juju/retry latest
go: finding github.com/prometheus/client_model/go latest
go: finding github.com/prometheus/client_golang v0.8.0
go: finding github.com/masterzen/winrm latest
go: finding github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions latest
go: finding github.com/gorilla/handlers v1.4.0
go: downloading github.com/juju/retry v0.0.0-20160928201858-1998d01ba1c3
go: downloading github.com/prometheus/client_golang v0.8.0
go: finding github.com/joyent/gocommon/client latest
go: finding github.com/prometheus/client_model latest
go: downloading github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: finding github.com/juju/testing/filetesting latest
go: finding github.com/joyent/gosign latest
go: downloading github.com/joyent/gosign v0.0.0-20161114191744-9abcee278795
go: downloading github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6
go: downloading github.com/masterzen/winrm v0.0.0-20180702085143-58761a495ca4
go: finding github.com/davecgh/go-spew/spew latest
go: finding github.com/stretchr/testify/assert latest
go: finding github.com/juju/romulus/wireformat/plan latest
go: downloading github.com/gorilla/handlers v1.4.0
go: finding gopkg.in/natefinch/npipe.v2 latest
go: downloading github.com/juju/bundlechanges v0.0.0-20180718043943-bc5b7e5db166
go: finding github.com/joyent/gocommon latest
go: downloading github.com/joyent/gocommon v0.0.0-20161202192317-b78708995d1c
go: finding github.com/juju/terms-client/api latest
go: finding github.com/juju/romulus/wireformat latest
go: finding github.com/juju/romulus latest
go: downloading github.com/juju/romulus v0.0.0-20180724155144-958d8b71e5ff
go: finding github.com/Azure/azure-sdk-for-go/storage latest
go: finding gopkg.in/goose.v2 latest
go: finding github.com/davecgh/go-spew v1.1.1
go: downloading github.com/davecgh/go-spew v1.1.1
go: finding github.com/stretchr/testify v1.2.2
go: downloading github.com/stretchr/testify v1.2.2
go: downloading gopkg.in/juju/charmstore.v5-unstable v5.0.0-20180220120900-925d3c2cb8b8
go: downloading gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
go: downloading github.com/juju/httpprof v0.0.0-20141217160036-14bf14c30767
go: finding github.com/juju/terms-client v1.0.1
go: finding github.com/Azure/go-autorest/autorest/to latest
go: finding github.com/vmware/govmomi/vim25/types latest
go: finding github.com/joyent/gosdc/localservices/cloudapi latest
go: downloading github.com/juju/terms-client v1.0.1
go: finding github.com/juju/go-oracle-cloud/api latest
go: downloading gopkg.in/goose.v2 v2.0.0-20180816040309-cf9b64132d71
go: finding github.com/Azure/go-autorest/autorest/azure latest
go: finding gopkg.in/ini.v1 v1.38.1
go: finding github.com/google/go-querystring/query latest
go: finding github.com/juju/gomaasapi latest
go: finding github.com/Azure/go-autorest/autorest latest
go: finding github.com/joyent/gosdc/localservices latest
go: finding github.com/joyent/gosdc latest
go: downloading github.com/joyent/gosdc v0.0.0-20161202192312-ec8b3503a75e
go: finding github.com/Azure/go-autorest/autorest/mocks latest
go: finding github.com/juju/go-oracle-cloud latest
go: downloading github.com/juju/go-oracle-cloud v0.0.0-20170510162943-95ad2a088ab9
go: finding github.com/juju/romulus/wireformat/metrics latest
go: finding github.com/google/go-querystring latest
go: downloading github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135
go: downloading github.com/mattn/go-colorable v0.0.6
go: finding github.com/joyent/gocommon/errors latest
go: finding github.com/juju/go-oracle-cloud/common latest
go: finding github.com/juju/go-oracle-cloud/response latest
go: downloading github.com/juju/go4 v0.0.0-20160222163258-40d72ab9641a
go: finding github.com/vmware/govmomi/vim25/mo latest
go: downloading gopkg.in/ini.v1 v1.38.1
go: finding github.com/vmware/govmomi/find latest
go: finding github.com/BurntSushi/toml v0.3.0
go: downloading github.com/juju/gomaasapi v0.0.0-20180521080429-abe11904dd8c
go: finding github.com/vmware/govmomi/vim25/xml latest
go: downloading github.com/BurntSushi/toml v0.3.0
go: finding github.com/vmware/govmomi/vim25 latest
go: finding github.com/vmware/govmomi v0.18.0
go: finding github.com/Azure/go-autorest v10.15.2+incompatible
go: downloading github.com/Azure/go-autorest v10.15.2+incompatible
go: finding github.com/juju/romulus/wireformat/sla latest
go: finding github.com/Azure/azure-sdk-for-go/arm/network latest
go: finding github.com/vmware/govmomi/object latest
go: finding github.com/lxc/lxd/shared latest
go: downloading github.com/vmware/govmomi v0.18.0
go: finding github.com/vmware/govmomi/vim25/soap latest
go: finding github.com/juju/terms-client/api/wireformat latest
go: downloading github.com/juju/usso v0.0.0-20160401104424-68a59c96c178
go: finding github.com/lxc/lxd/shared/osarch latest
go: finding github.com/Azure/azure-sdk-for-go/arm/authorization latest
go: finding github.com/vmware/govmomi/list latest
go: finding github.com/juju/romulus/api/budget latest
go: finding github.com/juju/romulus/api latest
go: finding github.com/vmware/govmomi/session latest
go: downloading github.com/juju/version v0.0.0-20161031051906-1f41e27e54f2
go: finding github.com/vmware/govmomi/property latest
go: finding github.com/Azure/azure-sdk-for-go/arm/resources latest
go: finding github.com/Azure/azure-sdk-for-go/arm latest
go: downloading github.com/godbus/dbus v0.0.0-20160506222550-32c6cc29c145
go: downloading github.com/lestrrat/go-jsref v0.0.0-20160601013240-e452c7b5801d
go: downloading github.com/lestrrat/go-structinfo v0.0.0-20160308131105-f74c056fe41f
go: finding github.com/juju/romulus/api/sla latest
go: downloading github.com/juju/gojsonreference v0.0.0-20150204194633-f0d24ac5ee33
go: downloading github.com/juju/gojsonpointer v0.0.0-20150204194629-afe8b77aa08f
go: finding github.com/lxc/lxd latest
go: finding gopkg.in/amz.v3 latest
go: downloading gopkg.in/amz.v3 v3.0.0-20161215130849-8c3190dff075
go: downloading github.com/lxc/lxd v0.0.0-20180820201306-caf879a891bf
go: finding github.com/Azure/azure-sdk-for-go/arm/storage latest
go: finding golang.org/x/oauth2/google latest
go: finding golang.org/x/oauth2 latest
go: finding github.com/juju/romulus/wireformat/budget latest
go: finding github.com/joyent/gosdc/cloudapi latest
go: finding github.com/juju/romulus/api/plan latest
go: downloading golang.org/x/oauth2 v0.0.0-20180820191322-f720f1faee02
go: finding github.com/lxc/lxd/shared/api latest
go: finding github.com/Azure/azure-sdk-for-go/arm/resources/resources latest
go: finding github.com/vmware/govmomi/vim25/progress latest
go: finding github.com/vmware/govmomi/vim25/methods latest
go: downloading github.com/lestrrat/go-jspointer v0.0.0-20160229021354-f4881e611bdb
go: finding gopkg.in/tomb.v2 latest
go: finding google.golang.org/api/compute latest
go: finding google.golang.org/api/googleapi latest
go: downloading gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
go: finding github.com/Azure/azure-sdk-for-go/arm/compute latest
go: finding google.golang.org/api latest
go: downloading google.golang.org/api v0.0.0-20180818000503-e21acd801f91
go: finding github.com/altoros/gosigma latest
go: finding github.com/gosuri/uitable latest
go: downloading github.com/altoros/gosigma v0.0.0-20150408145232-31228935eec6
go: finding github.com/altoros/gosigma/data latest
go: downloading github.com/gosuri/uitable v0.0.0-20160404203958-36ee7e946282
go: finding github.com/altoros/gosigma/mock latest
go: finding github.com/xeipuuv/gojsonschema latest
go: downloading github.com/xeipuuv/gojsonschema v0.0.0-20180816142147-da425ebb7609
go: finding launchpad.net/gocheck latest
go: downloading launchpad.net/gocheck v0.0.0-20140225173054-000000000087
go: finding github.com/Azure/azure-sdk-for-go v19.1.0+incompatible
go: downloading github.com/Azure/azure-sdk-for-go v19.1.0+incompatible
$ echo $?
0
$ cat go.mod
module github.com/rogpeppe/misc/cmd/juju-watchall
$ cat go.sum

I'm not sure if an empty go.mod is what we want. I re-ran go mod tidy just in case, and got the same files with no error.

@bcmills
Copy link
Contributor

bcmills commented Aug 21, 2018

The facts that @rogpeppe's trace includes par.(*Cache).Do and @mvdan couldn't reproduce the issue with the same steps leads me to suspect a data race.

Could one of you try it with a cmd/go built with the race detector enabled and see if it finds anything?

@rogpeppe
Copy link
Contributor Author

I tried with the race detector enabled and no races were detected, although it did crash immediately.

Like @mvdan, I find that the issue appears to be fixed on tip (I used +4e1b11e2c9 Tue Aug 21 14:08:55 2018 +0000)

@rsc
Copy link
Contributor

rsc commented Aug 21, 2018

This is fixed on master and the release branch but didn't make it into rc1. Sorry for the trouble.

@rsc rsc closed this as completed Aug 21, 2018
@golang golang locked and limited conversation to collaborators Aug 21, 2019
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