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

Panic when sending batch of raw queries #4

Open
jdiamond opened this issue Oct 23, 2024 · 0 comments
Open

Panic when sending batch of raw queries #4

jdiamond opened this issue Oct 23, 2024 · 0 comments

Comments

@jdiamond
Copy link

I now know batches of raw queries are not supported yet. The application I'm working on is using them and it's making the proxy panic.

When we send a batch of raw queries, we see an error like this for every statement in the batch:

{"level":"error","time":"2024-10-22T18:06:56.787Z","caller":"proxy/proxy.go:1028","msg":"Item is not of type [16]byte","stacktrace":"github.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxy.(*client).handleBatch\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxy/proxy.go:1028\ngithub.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxy.(*client).Receive\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxy/proxy.go:643\ngithub.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxycore.(*Conn).read\n\t/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxycore/conn.go:114"}

Then we see a panic like this and the proxy has to be restarted:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x11a6fe6]

goroutine 116 [running]:
github.com/ollionorg/cassandra-to-spanner-proxy/spanner.(*SpannerClient).filterBatch(0x1889698?, {0x185c898, 0xc0006fa960}, 0xc000631e40?, {0xc0006f7860, 0xc, 0x0?})
	/go/src/cassandra-to-spanner-proxy/spanner/spanner.go:981 +0x146
github.com/ollionorg/cassandra-to-spanner-proxy/spanner.(*SpannerClient).FilterAndExecuteBatch.func1({0x185c898, 0xc0006fa960}, 0x13a12a0?)
	/go/src/cassandra-to-spanner-proxy/spanner/spanner.go:713 +0x5e
cloud.google.com/go/spanner.(*ReadWriteTransaction).runInTransaction(0xc0005f26e0, {0x185c898, 0xc0006fa450}, 0xc000573838)
	/go/pkg/mod/cloud.google.com/go/[email protected]/transaction.go:1708 +0x69
cloud.google.com/go/spanner.(*Client).rwTransaction.func2({0x185c898, 0xc0006fa450})
	/go/pkg/mod/cloud.google.com/go/[email protected]/client.go:860 +0x817
cloud.google.com/go/spanner.runWithRetryOnAbortedOrFailedInlineBeginOrSessionNotFound.func1({0x185c898, 0xc0006fa450})
	/go/pkg/mod/cloud.google.com/go/[email protected]/retry.go:91 +0x64
cloud.google.com/go/spanner.runWithRetryOnAbortedOrFailedInlineBeginOrSessionNotFound({0x185c898, 0xc0006fa450}, 0xc0002a3698)
	/go/pkg/mod/cloud.google.com/go/[email protected]/retry.go:131 +0x1ba
cloud.google.com/go/spanner.(*Client).rwTransaction(0xc0005e4c80, {0x185c898, 0xc0006fa450}, 0xc0002a3838, {{0x0, 0xc0003772a0}, {0x0, 0x0}, 0x0, 0x0, ...})
	/go/pkg/mod/cloud.google.com/go/[email protected]/client.go:816 +0x1bd
cloud.google.com/go/spanner.(*Client).ReadWriteTransactionWithOptions(0x60?, {0x185c8d0?, 0xc0004052c0?}, 0xc0002a3860?, {{0x0, 0xc0003772a0}, {0x0, 0x0}, 0x0, 0x0, ...})
	/go/pkg/mod/cloud.google.com/go/[email protected]/client.go:798 +0x10c
github.com/ollionorg/cassandra-to-spanner-proxy/spanner.(*SpannerClient).FilterAndExecuteBatch(0xc0003b7d70, {0x185c8d0, 0xc0004052c0}, {0xc0006f7860, 0xc, 0xc})
	/go/src/cassandra-to-spanner-proxy/spanner/spanner.go:712 +0x10f
github.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxy.(*client).handleBatch(0xc0006f8f00, 0xc000448b40, 0xc0006fa3c0)
	/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxy/proxy.go:1088 +0x13a8
github.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxy.(*client).Receive(0xc0006f8f00, {0x183f260?, 0xc0006f7680?})
	/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxy/proxy.go:643 +0x625
github.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxycore.(*Conn).read(0xc0006f7740)
	/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxycore/conn.go:114 +0x33
created by github.com/ollionorg/cassandra-to-spanner-proxy/third_party/datastax/proxycore.(*Conn).Start in goroutine 80
	/go/src/cassandra-to-spanner-proxy/third_party/datastax/proxycore/conn.go:107 +0x56

I get that we are trying to do something that is documented as not being supported, but I think the DX could be improved with a helpful error message instead of just panicking. Took us over an hour of debugging to figure out what was happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant