Skip to content

*documentdb.Conn has not been finalized #5446

@AlekSi

Description

@AlekSi

What should be done?

https://github.com/FerretDB/FerretDB/actions/runs/17089875768/job/48461255692?pr=5444

panic: *documentdb.Conn has not been finalized
	Object created by goroutine 54196 [running]:
	runtime/debug.Stack()
		/opt/hostedtoolcache/go/1.24.6/x64/src/runtime/debug/stack.go:26 +0x67
	github.com/FerretDB/FerretDB/v2/internal/util/resource.Track[...](0xc003aa6800, 0xc002478720)
		/home/runner/work/FerretDB/FerretDB/internal/util/resource/resource.go:89 +0x29e
	github.com/FerretDB/FerretDB/v2/internal/documentdb.newConn(0xc0036f72a8)
		/home/runner/work/FerretDB/FerretDB/internal/documentdb/conn.go:39 +0x205
	github.com/FerretDB/FerretDB/v2/internal/documentdb.(*Pool).Acquire(0xc0012ca240)
		/home/runner/work/FerretDB/FerretDB/internal/documentdb/pool.go:89 +0x126
	github.com/FerretDB/FerretDB/v2/internal/documentdb.(*Pool).WithConn(0xc0012ca240, 0xc00367db40)
		/home/runner/work/FerretDB/FerretDB/internal/documentdb/pool.go:95 +0x9b
	github.com/FerretDB/FerretDB/v2/internal/handler.(*Handler).msgCurrentOp(0xc0014d2140, {0x249c078, 0xc0037ab290}, 0xc00308b660)
		/home/runner/work/FerretDB/FerretDB/internal/handler/msg_currentop.go:43 +0x2a5
	github.com/FerretDB/FerretDB/v2/internal/handler.(*Handler).Handle(0xc0014d2140, {0x249c078, 0xc0037ab290}, 0xc00308b660)
		/home/runner/work/FerretDB/FerretDB/internal/handler/handler.go:216 +0x6a8
	github.com/FerretDB/FerretDB/v2/internal/handler/middleware.(*dispatcher).Dispatch(0xc00230bfa0, {0x249c078, 0xc0037ab290}, 0xc00308b660)
		/home/runner/work/FerretDB/FerretDB/internal/handler/middleware/dispatcher.go:132 +0x264
	github.com/FerretDB/FerretDB/v2/internal/handler/middleware.(*Middleware).dispatch.func1()
		/home/runner/work/FerretDB/FerretDB/internal/handler/middleware/middleware.go:170 +0x292
	created by github.com/FerretDB/FerretDB/v2/internal/handler/middleware.(*Middleware).dispatch in goroutine 13809
		/home/runner/work/FerretDB/FerretDB/internal/handler/middleware/middleware.go:161 +0x29d
	

goroutine 18 [running]:
github.com/FerretDB/FerretDB/v2/internal/util/resource.cleanup(0xc002478720)
	/home/runner/work/FerretDB/FerretDB/internal/util/resource/resource.go:40 +0xa7

We should test pool.WithConn by invoking GC or something. See https://go.dev/doc/gc-guide#Testing_object_death

Where?

TBD

Definition of Done

  • handler updated;
  • unit tests added/updated;
  • integration/compatibility tests added/updated;
  • spot refactorings done;
  • user documentation updated (or an issue to create documentation created);
  • something else?

Metadata

Metadata

Assignees

Labels

code/choreCode maintenance improvementsnot readyIssues that are not ready to be worked on; PRs that should skip CI

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions