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 due to connection issues #52

Open
alok87 opened this issue Oct 22, 2021 · 1 comment
Open

Panic due to connection issues #52

alok87 opened this issue Oct 22, 2021 · 1 comment
Labels

Comments

@alok87
Copy link

alok87 commented Oct 22, 2021

Beanstalk should gracefully return error instead of panicking if there is an connection issue.

We see our code crashes due to this panic.

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

goroutine 24968 [running]:
github.com/beanstalkd/go-beanstalk.(*Conn).cmd(0x0, 0xc002957040, 0xc00071fa40, {0x0, 0x1761ca0, 0x0}, {0x19a437a, 0x14}, {0xc00071fa30, 0x1, ...})
	/src/vendor/github.com/beanstalkd/go-beanstalk/conn.go:76 +0x8c
github.com/beanstalkd/go-beanstalk.(*TubeSet).Reserve(0xc0027558e0, 0xc00071fa90)
	/src/vendor/github.com/beanstalkd/go-beanstalk/tubeset.go:30 +0x98

Please suggest why this happens, and where the fix is required.

We tried to handle this at our code end to reduce its occurence, but it still occurs sometime practo/k8s-worker-pod-autoscaler#88

@kr
Copy link
Member

kr commented Oct 24, 2021

Is it possible you're calling Reserve on a zero-value tube set? For example:

var ts beanstalk.TubeSet
// ts.Conn not initialized

// ... other code ...

ts.Reserve(...)

I believe that would result in the panic you've reported.

@kr kr added the question label Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants