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

fix(server): fix NPE causes server crash #553

Merged
merged 2 commits into from
Oct 18, 2024
Merged

fix(server): fix NPE causes server crash #553

merged 2 commits into from
Oct 18, 2024

Conversation

mattisonchao
Copy link
Member

@mattisonchao mattisonchao commented Oct 17, 2024

Motivation

Oct 16 17:43:07.322395 DBG Received list request component=leader-controller namespace=default request={"endExclusive":"__oxia/session/0000000000000000//","shard":"0","startInclusive":"__oxia/session/0000000000000000/"} shard=2 term=2
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0x1545b3b]

goroutine 1275 [running]:
github.com/streamnative/oxia/server.(*leaderController).list.func1()
	/home/runner/work/oxia/oxia/server/leader_controller.go:654 +0x25b
github.com/streamnative/oxia/common.DoWithLabels.func1({0x1b2cf80?, 0xc000833020?})
	/home/runner/work/oxia/oxia/common/pprof.go:46 +0x2f
runtime/pprof.Do({0x1b2cd50, 0x332be60}, {{0xc001294c00?, 0x1?, 0x1?}}, 0xc000880d10)
	/opt/hostedtoolcache/go/1.22.8/x64/src/runtime/pprof/runtime.go:51 +0x118
github.com/streamnative/oxia/common.DoWithLabels({0x1b2cd50, 0x332be60}, 0xc000880f40, 0xc000880dc8)
	/home/runner/work/oxia/oxia/common/pprof.go:42 +0x585
github.com/streamnative/oxia/server.(*leaderController).list(0xc000ef2120, {0x1b2cd50, 0x332be60}, 0xc001294b40, 0xc00073e540)
	/home/runner/work/oxia/oxia/server/leader_controller.go:639 +0x3b6
created by github.com/streamnative/oxia/server.(*leaderController).ListSliceNoMutex in goroutine 981
	/home/runner/work/oxia/oxia/server/leader_controller.go:686 +0x216
FAIL	github.com/streamnative/oxia/server	8.710s
ok  	github.com/streamnative/oxia/server/kv	8.788s	coverage: 80.2% of statements
ok  	github.com/streamnative/oxia/server/util	1.018s	coverage: 8.5% of statements
ok  	github.com/streamnative/oxia/server/wal	4.214s	coverage: 73.4% of statements
ok  	github.com/streamnative/oxia/server/wal/codec	1.014s	coverage: 83.8% of statements
ok  	github.com/streamnative/oxia/tests/security/auth	5.209s	coverage: 80.5% of statements
ok  	github.com/streamnative/oxia/tests/security/tls	10.355s	coverage: 32.7% of statements
FAIL
make: *** [Makefile:24: test] Error 1

https://github.com/streamnative/oxia/actions/runs/11370802586/attempts/2?pr=552

Modification

  • Close resources before deleting.
  • Add logic to avoid repeated closures

@mattisonchao mattisonchao self-assigned this Oct 17, 2024
@mattisonchao mattisonchao marked this pull request as draft October 17, 2024 01:15
@mattisonchao mattisonchao marked this pull request as ready for review October 17, 2024 01:32
@mattisonchao mattisonchao marked this pull request as draft October 17, 2024 02:00
@mattisonchao mattisonchao marked this pull request as ready for review October 17, 2024 02:45
@merlimat merlimat merged commit 7c929b5 into main Oct 18, 2024
7 checks passed
@merlimat merlimat deleted the fix.npe branch October 18, 2024 15:03
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

Successfully merging this pull request may close these issues.

2 participants