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

spanner: infinite retrying due to invalid utf-8 query #2443

Closed
hengfengli opened this issue Jun 12, 2020 · 1 comment · Fixed by #2460
Closed

spanner: infinite retrying due to invalid utf-8 query #2443

hengfengli opened this issue Jun 12, 2020 · 1 comment · Fixed by #2460
Assignees
Labels
api: spanner Issues related to the Spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@hengfengli
Copy link
Contributor

Client

spanner/v1.6.0

Code

package main
 
import (
	"context"
	"encoding/base64"
	"log"
 
	"cloud.google.com/go/spanner"
)
 
const db = "projects/:project/instances/:instance/databases/:database"
 
func main() {
	ctx := context.Background()
	client, _ := spanner.NewClient(ctx, db)
	b, _ := base64.StdEncoding.DecodeString("hoge")
	log.Println("query")
	iter := client.Single().Query(ctx, spanner.Statement{
		SQL:    "SELECT * FROM Singers WHERE FirstName = @singerName",
		Params: map[string]interface{}{"singerName": string(b)},
	})
	log.Println("next")
	if _, err := iter.Next(); err != nil {
		log.Fatalf("%+v", err)
	}
	log.Println("done")
}

Expected behavior

Get an internal error: rpc error: code = Internal desc = grpc: error while marshaling: string field contains invalid UTF-8

Actual behavior

It causes an Infinite retrying behaviour.

@hengfengli hengfengli added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. api: spanner Issues related to the Spanner API. labels Jun 12, 2020
@hengfengli hengfengli self-assigned this Jun 12, 2020
@hengfengli
Copy link
Contributor Author

The current plan is to keep consistent with Java client lib to only retry one of three specific types of internal errors:

https://github.com/googleapis/java-spanner/blob/f89da6a1f4f8a86c136a23dfd2f5b073dd65407a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerExceptionFactory.java#L257-L269

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant