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

grpc.RoundRobin and grpc.WithBalancer no longer exist #441

Closed
jqll opened this issue Jan 10, 2020 · 27 comments
Closed

grpc.RoundRobin and grpc.WithBalancer no longer exist #441

jqll opened this issue Jan 10, 2020 · 27 comments
Assignees
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: process A process-related concern. May include testing, release, or the like.

Comments

@jqll
Copy link

jqll commented Jan 10, 2020

We are using this library and seeing these errors:

../google.golang.org/api/option/option.go:153:14: undefined: grpc.RoundRobin
../google.golang.org/api/option/option.go:154:42: undefined: grpc.WithBalancer

Sounds like gRPC removed these legacy APIs: grpc/grpc-go@336cf8d

@menghanl
Copy link

menghanl commented Jan 10, 2020

gRPC is pined at version v1.20.1, so this shouldn't break until the version is bumped The version specified is actually the mininum required version. But until the gRPC change is released, it should only break users pulling gRPC from head:

google.golang.org/grpc v1.20.1

@nolanmar511
Copy link

We're not yet using go modules in the test cases which we saw this failure with, so that might explain why pinning within google-api-go-client/go.mod didn't have an effect for our use case.

Is it expected, then, that this change will break users who aren't using go modules?

@dfawley
Copy link

dfawley commented Jan 10, 2020

This change will break users who are using go modules as well due to MVS.

Unfortunately, these APIs must be removed. They were marked as experimental since v1.0 and have been marked with deprecation tags for 6 months. Removing them is allowed under the grpc-go versioning policy.

@nolanmar511
Copy link

@menghanl -- Is it possible to confirm (or check) that using go modules will fix this issue? If so, is that our only work-around.

I'm a bit hesitant to attempt to adopt go modules right now if it won't necessarily provide a fix.

@dfawley
Copy link

dfawley commented Jan 11, 2020

If you use go modules in your own project, you can pin a specific version, which would work:

https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive

Alternatively, you could vendor grpc at an older version.

@nolanmar511
Copy link

Thanks. I'll work on switching to using go modules. Perhaps my team missed some sign that this was coming, but it's been a difficult surprise for us.

Since it seems like this library now exclusively supports users who also use go modules, it would be nice to see that mentioned on the README.md for this repo. If it's documented somewhere else, a pointer to that documentation would be great.

@max202021
Copy link

max202021 commented Jan 12, 2020

Any updated on this? it is blocking production google cloud build.

if changing to go Mod is going to take time and can grpc team rollback this commit and make those api available as quick fix?

In my docker file , I have following Lines

RUN go get -v -u go.mongodb.org/mongo-driver/mongo

RUN go get -d -v ./...

RUN go get google.golang.org/api/option

I am getting following error . Everything was working fine 3 days before.

```

Step 9/17 : RUN go get google.golang.org/api/option
---> Running in ec36bafa25aa
# google.golang.org/api/option
../google.golang.org/api/option/option.go:153:14: undefined: grpc.RoundRobin
../google.golang.org/api/option/option.go:154:42: undefined: grpc.WithBalancer
The command '/bin/sh -c go get google.golang.org/api/option' returned a non-zero code: 2

raphael added a commit to goadesign/goa that referenced this issue Jan 13, 2020
* Correct name of HTTP response status 415

* Update dependencies

* Attempt to workaround googleapis/google-api-go-client#441

* Fix response header validation panic

When design incorrectly omits corresponding result attribute

* Fix build
@cosmin8905
Copy link

cosmin8905 commented Jan 13, 2020

Update:
The issue still appears to be happening:

go get -u google.golang.org/api/option
# google.golang.org/api/option
/Users/cosmin/go/src/google.golang.org/api/option/option.go:153:14: undefined: grpc.RoundRobin
/Users/cosmin/go/src/google.golang.org/api/option/option.go:154:42: undefined: grpc.WithBalancer

stapelberg added a commit to stapelberg/scan2drive that referenced this issue Jan 13, 2020
This works around build issues with this not-yet-updated module:
googleapis/google-api-go-client#441
@stapelberg
Copy link

FYI: to pin gRPC to the latest released version (before the symbols were removed), use:

go mod edit -replace google.golang.org/grpc=google.golang.org/grpc@v1.26.0

@dfawley
Copy link

dfawley commented Jan 13, 2020

FYI: to pin gRPC to the latest released version (before the symbols were removed), use:

NOTE: this will only work on a top-level go.mod file, i.e. the one that contains the go binary you are building. It does not work in a library's go.mod, so it could not be applied in this repo.

@dfawley
Copy link

dfawley commented Jan 13, 2020

Sent #442 to remove the usages of the experimental gRPC API. Anyone depending on this experimental API will be broken, but users not depending on them will be unbroken.

@Niek-Okido
Copy link

i made line 153 and 154 as command that is the one that causing the issue :
this is not perfect but when you are sure you are not using this function will be no problem so replace the : \go\src\google.golang.org\api\option\option.go with the the text below

kind regards Niek Tuytel

`// Copyright 2017 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Package option contains options for Google API clients.
package option

import (
"net/http"

"golang.org/x/oauth2"
"google.golang.org/api/internal"
"google.golang.org/grpc"

)

// A ClientOption is an option for a Google API client.
type ClientOption interface {
Apply(*internal.DialSettings)
}

// WithTokenSource returns a ClientOption that specifies an OAuth2 token
// source to be used as the basis for authentication.
func WithTokenSource(s oauth2.TokenSource) ClientOption {
return withTokenSource{s}
}

type withTokenSource struct{ ts oauth2.TokenSource }

func (w withTokenSource) Apply(o *internal.DialSettings) {
o.TokenSource = w.ts
}

type withCredFile string

func (w withCredFile) Apply(o *internal.DialSettings) {
o.CredentialsFile = string(w)
}

// WithCredentialsFile returns a ClientOption that authenticates
// API calls with the given service account or refresh token JSON
// credentials file.
func WithCredentialsFile(filename string) ClientOption {
return withCredFile(filename)
}

// WithServiceAccountFile returns a ClientOption that uses a Google service
// account credentials file to authenticate.
//
// Deprecated: Use WithCredentialsFile instead.
func WithServiceAccountFile(filename string) ClientOption {
return WithCredentialsFile(filename)
}

// WithCredentialsJSON returns a ClientOption that authenticates
// API calls with the given service account or refresh token JSON
// credentials.
func WithCredentialsJSON(p []byte) ClientOption {
return withCredentialsJSON(p)
}

type withCredentialsJSON []byte

func (w withCredentialsJSON) Apply(o *internal.DialSettings) {
o.CredentialsJSON = make([]byte, len(w))
copy(o.CredentialsJSON, w)
}

// WithEndpoint returns a ClientOption that overrides the default endpoint
// to be used for a service.
func WithEndpoint(url string) ClientOption {
return withEndpoint(url)
}

type withEndpoint string

func (w withEndpoint) Apply(o *internal.DialSettings) {
o.Endpoint = string(w)
}

// WithScopes returns a ClientOption that overrides the default OAuth2 scopes
// to be used for a service.
func WithScopes(scope ...string) ClientOption {
return withScopes(scope)
}

type withScopes []string

func (w withScopes) Apply(o *internal.DialSettings) {
o.Scopes = make([]string, len(w))
copy(o.Scopes, w)
}

// WithUserAgent returns a ClientOption that sets the User-Agent.
func WithUserAgent(ua string) ClientOption {
return withUA(ua)
}

type withUA string

func (w withUA) Apply(o *internal.DialSettings) { o.UserAgent = string(w) }

// WithHTTPClient returns a ClientOption that specifies the HTTP client to use
// as the basis of communications. This option may only be used with services
// that support HTTP as their communication transport. When used, the
// WithHTTPClient option takes precedent over all other supplied options.
func WithHTTPClient(client *http.Client) ClientOption {
return withHTTPClient{client}
}

type withHTTPClient struct{ client *http.Client }

func (w withHTTPClient) Apply(o *internal.DialSettings) {
o.HTTPClient = w.client
}

// WithGRPCConn returns a ClientOption that specifies the gRPC client
// connection to use as the basis of communications. This option may only be
// used with services that support gRPC as their communication transport. When
// used, the WithGRPCConn option takes precedent over all other supplied
// options.
func WithGRPCConn(conn *grpc.ClientConn) ClientOption {
return withGRPCConn{conn}
}

type withGRPCConn struct{ conn *grpc.ClientConn }

func (w withGRPCConn) Apply(o *internal.DialSettings) {
o.GRPCConn = w.conn
}

// WithGRPCDialOption returns a ClientOption that appends a new grpc.DialOption
// to an underlying gRPC dial. It does not work with WithGRPCConn.
func WithGRPCDialOption(opt grpc.DialOption) ClientOption {
return withGRPCDialOption{opt}
}

type withGRPCDialOption struct{ opt grpc.DialOption }

func (w withGRPCDialOption) Apply(o *internal.DialSettings) {
o.GRPCDialOpts = append(o.GRPCDialOpts, w.opt)
}

// WithGRPCConnectionPool returns a ClientOption that creates a pool of gRPC
// connections that requests will be balanced between.
// This is an EXPERIMENTAL API and may be changed or removed in the future.
func WithGRPCConnectionPool(size int) ClientOption {
return withGRPCConnectionPool(size)
}

type withGRPCConnectionPool int

func (w withGRPCConnectionPool) Apply(o *internal.DialSettings) {
// balancer := grpc.RoundRobin(internal.NewPoolResolver(int(w), o))
// o.GRPCDialOpts = append(o.GRPCDialOpts, grpc.WithBalancer(balancer))
}

// WithAPIKey returns a ClientOption that specifies an API key to be used
// as the basis for authentication.
//
// API Keys can only be used for JSON-over-HTTP APIs, including those under
// the import path google.golang.org/api/....
func WithAPIKey(apiKey string) ClientOption {
return withAPIKey(apiKey)
}

type withAPIKey string

func (w withAPIKey) Apply(o *internal.DialSettings) { o.APIKey = string(w) }

// WithAudiences returns a ClientOption that specifies an audience to be used
// as the audience field ("aud") for the JWT token authentication.
func WithAudiences(audience ...string) ClientOption {
return withAudiences(audience)
}

type withAudiences []string

func (w withAudiences) Apply(o *internal.DialSettings) {
o.Audiences = make([]string, len(w))
copy(o.Audiences, w)
}

// WithoutAuthentication returns a ClientOption that specifies that no
// authentication should be used. It is suitable only for testing and for
// accessing public resources, like public Google Cloud Storage buckets.
// It is an error to provide both WithoutAuthentication and any of WithAPIKey,
// WithTokenSource, WithCredentialsFile or WithServiceAccountFile.
func WithoutAuthentication() ClientOption {
return withoutAuthentication{}
}

type withoutAuthentication struct{}

func (w withoutAuthentication) Apply(o *internal.DialSettings) { o.NoAuth = true }

// WithQuotaProject returns a ClientOption that specifies the project used
// for quota and billing purposes.
//
// For more information please read:
// https://cloud.google.com/apis/docs/system-parameters
func WithQuotaProject(quotaProject string) ClientOption {
return withQuotaProject(quotaProject)
}

type withQuotaProject string

func (w withQuotaProject) Apply(o *internal.DialSettings) {
o.QuotaProject = string(w)
}

// WithRequestReason returns a ClientOption that specifies a reason for
// making the request, which is intended to be recorded in audit logging.
// An example reason would be a support-case ticket number.
//
// For more information please read:
// https://cloud.google.com/apis/docs/system-parameters
func WithRequestReason(requestReason string) ClientOption {
return withRequestReason(requestReason)
}

type withRequestReason string

func (w withRequestReason) Apply(o *internal.DialSettings) {
o.RequestReason = string(w)
}

// WithTelemetryDisabled returns a ClientOption that disables default telemetry (OpenCensus)
// settings on gRPC and HTTP clients.
// An example reason would be to bind custom telemetry that overrides the defaults.
func WithTelemetryDisabled() ClientOption {
return withTelemetryDisabledOption{}
}

type withTelemetryDisabledOption struct{}

func (w withTelemetryDisabledOption) Apply(o *internal.DialSettings) {
o.TelemetryDisabled = true
}
`

@Niek-Okido
Copy link

Niek-Okido commented Jan 13, 2020

`func (w withGRPCConnectionPool) Apply(o *internal.DialSettings) {

// balancer := grpc.RoundRobin(internal.NewPoolResolver(int(w), o))

// o.GRPCDialOpts = append(o.GRPCDialOpts, grpc.WithBalancer(balancer))

}

`

this is what i did and work for me
on the \go\src\google.golang.org\api\option\option.go file

@chadit
Copy link

chadit commented Jan 13, 2020

this also broke the googles own docs api for sheets.
https://developers.google.com/sheets/api/quickstart/go

cloud-profiler-github-robot pushed a commit to GoogleCloudPlatform/cloud-profiler-python that referenced this issue Jan 13, 2020
E2E test is broken, because it depends on google.golang.org/api/compute/v1, which depends on google.golang.org/api/option, which is currently broken for all users who are not using go modules (googleapis/google-api-go-client#441). This should allow our E2E test to pass again.

PiperOrigin-RevId: 289478716
@Fyb3roptik
Copy link

I am unable to switch to Go Modules right now and this has our Production systems down! PLEASE FIX!!!!!

@codyoss codyoss added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 13, 2020
@IlyaFaer IlyaFaer changed the title grpc.RoundRobin and grpc.WithBalancer on longer exist grpc.RoundRobin and grpc.WithBalancer no longer exist Jan 15, 2020
@Fyb3roptik
Copy link

I appreciate the quick response from everyone!

@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Jan 21, 2020
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Jan 31, 2020
gopherbot pushed a commit that referenced this issue Feb 4, 2020
This allows a ConnPool to be passed directly into the constructor of
gRPC stub clients.

Updates #441.

(also, update vet.sh to use go1.13 not go1.12)

Change-Id: Ibf83dfceb90b69099d7cca3b338f81f9cc26dc40
Reviewed-on: https://code-review.googlesource.com/c/google-api-go-client/+/51392
Reviewed-by: Noah Dietz <ndietz@google.com>
Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Feb 5, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
broady added a commit to googleapis/gapic-generator-go that referenced this issue Feb 6, 2020
gopherbot pushed a commit to googleapis/google-cloud-go that referenced this issue Feb 7, 2020
Removes references to Dial from hand-written clients (GAPICs will be
migrated soon with a change to the generator).

longrunning/autogen.InternalFromConn is deprecated.

Updates googleapis/google-api-go-client#441.

Change-Id: I49db1812b39c5c04aea58068c53467155f3570d3
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/51395
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tyler Bui-Palsulich <tbp@google.com>
Reviewed-by: Noah Dietz <ndietz@google.com>
gopherbot pushed a commit to googleapis/google-cloud-go that referenced this issue Feb 7, 2020
Generated constructor now uses gtransport.DialPool.

See googleapis/google-api-go-client#441

Change-Id: Icd24e41e54dcd7e31e2cb526abc978192ad4a00d
Reviewed-on: https://code-review.googlesource.com/c/gocloud/+/51630
Reviewed-by: Noah Dietz <ndietz@google.com>
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Feb 8, 2020
@broady
Copy link
Contributor

broady commented Feb 11, 2020

Quick update... Next steps:

  • tag a release of all modules in google-cloud-go
  • submit CL 50573
  • tag a release of google-api-go-client

@broady broady added type: process A process-related concern. May include testing, release, or the like. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Feb 13, 2020
@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

Successfully merging a pull request may close this issue.