datastore: query iterating over 36m objects panics with stack overflow #9528
Labels
api: datastore
Issues related to the Datastore API.
type: question
Request for information or clarification. Not an issue.
Client
Google Firestore in Datastore mode
Environment
Compile: macOS Ventura
Run: Linux (GKE pod)
Go Environment
$ go version
go version go1.22.0 darwin/amd64
$ go env
GO111MODULE='on'
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/ggreer/Library/Caches/go-build'
GOENV='/Users/ggreer/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/ggreer/p/go/pkg/mod'
GONOPROXY='github.com/GannettDigital'
GONOSUMDB='github.com/GannettDigital'
GOOS='darwin'
GOPATH='/Users/ggreer/p/go'
GOPRIVATE='github.com/GannettDigital'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/Cellar/go/1.22.0/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/Cellar/go/1.22.0/libexec/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users/ggreer/p/go/src/github.com/GannettDigital/sports2-aggregator/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/Users/ggreer/.tmp/go-build1573180754=/tmp/go-build -gno-record-gcc-switches -fno-common'
Code
There's a lot to the program but the "meat" of the panic is basically this code:
Expected behavior
Datastore client enumerates all 36 million objects.
Actual behavior
Datastore client slowly uses more and more memory until it panics with
runtime: goroutine stack exceeds 1000000000-byte limit
.Additional context
go.mod Google versions:
Stack trace for the crashing goroutine is:
The text was updated successfully, but these errors were encountered: