Skip to content

Instantly share code, notes, and snippets.

@grantr
Last active April 17, 2020 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantr/be73d8bacf21fc246d68a5f4290621b2 to your computer and use it in GitHub Desktop.
Save grantr/be73d8bacf21fc246d68a5f4290621b2 to your computer and use it in GitHub Desktop.
package main
import (
"context"
"cloud.google.com/go/pubsub"
"cloud.google.com/go/pubsub/pstest"
"google.golang.org/api/option"
"google.golang.org/grpc"
)
func main() {
srv := pstest.NewServer()
conn, _ := grpc.Dial(srv.Addr, grpc.WithInsecure())
defer srv.Close()
defer conn.Close()
c, _ := pubsub.NewClient(context.Background(), "project", option.WithGRPCConn(conn))
ctx := context.Background()
topic, _ := c.CreateTopic(ctx, "topic")
sub, _ := c.CreateSubscription(ctx, "sub", pubsub.SubscriptionConfig{Topic: topic})
topic.Delete(ctx)
sub.Delete(ctx)
}
panic: close of closed channel
goroutine 52 [running]:
cloud.google.com/go/pubsub/pstest.(*subscription).stop(...)
cloud.google.com/go/pubsub/pstest/fake.go:591
cloud.google.com/go/pubsub/pstest.(*GServer).DeleteSubscription(0xc0000be138, 0x16ef8e0, 0xc0004011a0, 0xc0004011d0, 0x0, 0x0, 0x0)
cloud.google.com/go/pubsub/pstest/fake.go:470 +0xfd
google.golang.org/genproto/googleapis/pubsub/v1._Subscriber_DeleteSubscription_Handler(0x16086a0, 0xc0000be138, 0x16ef8e0, 0xc0004011a0, 0xc000486a80, 0x0, 0x16ef8e0, 0xc0004011a0, 0xc0004c4330, 0x24)
google.golang.org/genproto/googleapis/pubsub/v1/pubsub.pb.go:3645 +0x217
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000d0f20, 0x16f48c0, 0xc0003a2480, 0xc0004c8600, 0xc000122d20, 0x1afec40, 0x0, 0x0, 0x0)
google.golang.org/grpc/server.go:995 +0x460
google.golang.org/grpc.(*Server).handleStream(0xc0000d0f20, 0x16f48c0, 0xc0003a2480, 0xc0004c8600, 0x0)
google.golang.org/grpc/server.go:1275 +0xd3d
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00039c060, 0xc0000d0f20, 0x16f48c0, 0xc0003a2480, 0xc0004c8600)
google.golang.org/grpc/server.go:710 +0xa1
created by google.golang.org/grpc.(*Server).serveStreams.func1
google.golang.org/grpc/server.go:708 +0xa1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment