Stork crashes on huge Kea configs
I prepared a Kea DHCP4 configuration file with 16392 subnets and 10 reservations per network.
Stork panics in the dbmodel.UpdateApp
function with the makeslice: cap out of range
error during save the configuration to the database.
Last Stork source line: backend/server/database/model/common.go:50
.
It seems that the error occurred during the serialization of the Kea configuration to the JSON file.
My Kea DHCP4 configuration has 29MB.
Call stack:
runtime.fatalpanic (/usr/lib/go/src/runtime/panic.go:1274)
runtime.gopanic (/usr/lib/go/src/runtime/panic.go:1147)
github.com/go-pg/pg/v10.(*Tx).RunInTransaction.func1 (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/tx.go:91)
runtime.gopanic (/usr/lib/go/src/runtime/panic.go:1047)
runtime.panicmakeslicecap (/usr/lib/go/src/runtime/slice.go:31)
runtime.makeslice (/usr/lib/go/src/runtime/slice.go:95)
github.com/vmihailenco/bufpool.(*bufPool).Get (/home/lv/go/pkg/mod/github.com/vmihailenco/bufpool@v0.1.11/buf_pool.go:45)
github.com/vmihailenco/bufpool.Get (/home/lv/go/pkg/mod/github.com/vmihailenco/bufpool@v0.1.11/buf_pool.go:17)
github.com/vmihailenco/bufpool.(*Buffer).grow (/home/lv/go/pkg/mod/github.com/vmihailenco/bufpool@v0.1.11/buffer_ext.go:57)
github.com/vmihailenco/bufpool.(*Buffer).Write (/home/lv/go/pkg/mod/github.com/vmihailenco/bufpool@v0.1.11/buffer.go:121)
encoding/json.(*Encoder).Encode (/usr/lib/go/src/encoding/json/stream.go:231)
github.com/go-pg/pg/v10/types.appendJSONValue (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/types/append_value.go:203)
github.com/go-pg/pg/v10/types.ptrAppenderFunc.func1 (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/types/append_value.go:130)
github.com/go-pg/pg/v10/orm.(*Field).AppendValue (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/orm/field.go:106)
github.com/go-pg/pg/v10/orm.(*UpdateQuery).appendSetStruct (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/orm/update.go:230)
github.com/go-pg/pg/v10/orm.(*UpdateQuery).mustAppendSet (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/orm/update.go:154)
github.com/go-pg/pg/v10/orm.(*UpdateQuery).AppendQuery (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/orm/update.go:78)
github.com/go-pg/pg/v10.appendQuery (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/messages.go:512)
github.com/go-pg/pg/v10.writeQueryMsg (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/messages.go:493)
github.com/go-pg/pg/v10.(*Tx).query (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/tx.go:223)
github.com/go-pg/pg/v10.(*Tx).QueryContext (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/tx.go:211)
github.com/go-pg/pg/v10/orm.(*Query).returningQuery (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/orm/query.go:1163)
github.com/go-pg/pg/v10/orm.(*Query).update (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/orm/query.go:1146)
github.com/go-pg/pg/v10/orm.(*Query).Update (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/orm/query.go:1111)
isc.org/stork/server/database/model.upsertInTransaction (/home/lv/Projects/stork2/backend/server/database/model/common.go:50)
isc.org/stork/server/database/model.updateAppDaemons (/home/lv/Projects/stork2/backend/server/database/model/app.go:130)
isc.org/stork/server/database/model.updateApp (/home/lv/Projects/stork2/backend/server/database/model/app.go:246)
isc.org/stork/server/database/model.UpdateApp (/home/lv/Projects/stork2/backend/server/database/model/app.go:270)
isc.org/stork/server/apps/kea.CommitAppIntoDB.func1 (/home/lv/Projects/stork2/backend/server/apps/kea/appkea.go:653)
github.com/go-pg/pg/v10.(*Tx).RunInTransaction (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/tx.go:95)
github.com/go-pg/pg/v10.(*baseDB).RunInTransaction (/home/lv/go/pkg/mod/github.com/go-pg/pg/v10@v10.10.6/tx.go:74)
isc.org/stork/server/apps/kea.CommitAppIntoDB (/home/lv/Projects/stork2/backend/server/apps/kea/appkea.go:604)
isc.org/stork/server/apps.GetMachineAndAppsState (/home/lv/Projects/stork2/backend/server/apps/statepuller.go:273)
isc.org/stork/server/apps.(*StatePuller).pullData (/home/lv/Projects/stork2/backend/server/apps/statepuller.go:62)
isc.org/stork/server/apps.(*StatePuller).pullData-fm (/home/lv/Projects/stork2/backend/server/apps/statepuller.go:48)
isc.org/stork/util.(*PeriodicExecutor).executorLoop (/home/lv/Projects/stork2/backend/util/periodicexecutor.go:166)
isc.org/stork/util.NewPeriodicExecutor·dwrap·1 (/home/lv/Projects/stork2/backend/util/periodicexecutor.go:64)
runtime.goexit (/usr/lib/go/src/runtime/asm_amd64.s:1581)