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 on nats server report connections with non-$SYS account #3917

Closed
MauriceVanVeen opened this issue Feb 27, 2023 · 0 comments · Fixed by #3919
Closed

panic on nats server report connections with non-$SYS account #3917

MauriceVanVeen opened this issue Feb 27, 2023 · 0 comments · Fixed by #3919

Comments

@MauriceVanVeen
Copy link
Contributor

MauriceVanVeen commented Feb 27, 2023

Defect

Versions of nats-server and affected client libraries used:

  • nats-server 2.9.14
  • nats-box 0.13.4

OS/Container environment:

  • Kubernetes with official Helm chart

Steps or code to reproduce the issue:

Tried reproducing this in a similar 3-node setup on Kubernetes, but sadly wasn't able to.

Normally, when doing a nats server report connections with a user under $SYS this command always successfully returns a report in the CLI. However, when running this with a non-$SYS account, this command may sometimes succeed, and other times it will lead into an error message in the CLI:

nats: error: server request failed, ensure the account used has system privileges and appropriate permissions

When running this command quite rapidly after each other, it sometimes will result in a panic. (Although I'm not quite sure if it's even related to running this quickly, or if it's a race condition.)

The following panic happened:

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

goroutine 178036893 [running]:
github.com/nats-io/nats-server/v2/server.(*serviceExport).setResponseThresholdTimer(...)
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/accounts.go:2227
github.com/nats-io/nats-server/v2/server.(*Account).addRespServiceImport(0xc000ba5440, 0xc000ba58c0, {0xc006c1abd0, 0x26}, 0xc003292090, 0x0, 0x0)
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/accounts.go:2347 +0x2f4
github.com/nats-io/nats-server/v2/server.(*client).setupResponseServiceImport(0xc0042f6600, 0xc002456d68?, 0xc003292090, 0x80?, 0xc002456df0?)
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/client.go:3724 +0x7f
github.com/nats-io/nats-server/v2/server.(*client).processServiceImport(0xc0042f6600, 0xc003292090, 0xc000ba58c0, {0xc00043004f, 0x100, 0x1b1})
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/client.go:3896 +0x44a
github.com/nats-io/nats-server/v2/server.(*Account).addServiceImportSub.func1(0x0?, 0x0?, 0x0?, {0x0?, 0x0?}, {0x0?, 0x0?}, {0xc00043004f, 0x100, 0x1b1})
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/accounts.go:1965 +0x32
github.com/nats-io/nats-server/v2/server.(*client).deliverMsg(0xc0042f6600, 0x0, 0xc002783140, 0x0?, {0xc000430005, 0x1a, 0x1fb}, {0xc000430020, 0x26, 0x1e0}, ...)
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/client.go:3192 +0xb89
github.com/nats-io/nats-server/v2/server.(*client).processMsgResults(0xc0042f6600, 0xc000ba58c0, 0xc001cf2330, {0xc00043004f, 0x100, 0x1b1}, {0x0, 0x0, 0x0?}, {0xc000430005, ...}, ...)
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/client.go:4239 +0xb10
github.com/nats-io/nats-server/v2/server.(*client).processInboundClientMsg(0xc0042f6600, {0xc00043004f, 0x100, 0x1b1})
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/client.go:3660 +0xaa8
github.com/nats-io/nats-server/v2/server.(*client).processInboundMsg(0xc0042f6600?, {0xc00043004f?, 0x48?, 0x1fb?})
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/client.go:3507 +0x3d
github.com/nats-io/nats-server/v2/server.(*client).parse(0xc0042f6600, {0xc000430000, 0x14f, 0x200})
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/parser.go:497 +0x210a
github.com/nats-io/nats-server/v2/server.(*client).readLoop(0xc0042f6600, {0x0, 0x0, 0x0})
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/client.go:1238 +0xf36
github.com/nats-io/nats-server/v2/server.(*Server).createClient.func1()
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/server.go:2654 +0x29
created by github.com/nats-io/nats-server/v2/server.(*Server).startGoRoutine
	/home/travis/gopath/src/github.com/nats-io/nats-server/server/server.go:3083 +0x85

Expected result:

Consistently return data that can be shown in the CLI report.

Actual result:

May panic a server, making it restart.

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 a pull request may close this issue.

2 participants