taskq
taskq copied to clipboard
Setting WorkerLimit in QueueOptions throws a nil pointer while using a Memqueue
Setting the Worker Limit to anything above 0 throws a nil pointer when using a memqueue.
My Setup:
qf = memqueue.NewFactory()
MessageQueue = qf.RegisterQueue(&taskq.QueueOptions{
Name: "pipeline-worker",
MinNumWorker: int32(runtime.NumCPU()),
MaxNumWorker: int32(runtime.NumCPU()),
WorkerLimit: 5,
ReservationSize: 1000000,
})
The error in func (c *Client) obtain(ctx context.Context, key, value string, ttl time.Duration) (bool, error)
:
invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation]
Unable to propagate EXC_BAD_ACCESS signal to target process and panic (see https://github.com/go-delve/delve/issues/852)
Stack:
0 0x0000000004c20e78 in github.com[/bsm/redislock.]()(*Client).obtain
at [/Users/schmar1/go/pkg/mod/github.com/bsm/redislock]()@v0.7.1[/redislock.go:97]()
1 0x0000000004c2087f in github.com[/bsm/redislock.]()(*Client).Obtain
at [/Users/schmar1/go/pkg/mod/github.com/bsm/redislock]()@v0.7.1[/redislock.go:69]()
2 0x0000000004c21438 in github.com[/bsm/redislock.Obtain]()
at [/Users/schmar1/go/pkg/mod/github.com/bsm/redislock]()@v0.7.1[/redislock.go:125]()
3 0x0000000004c57552 in github.com[/vmihailenco/taskq/v3.]()(*Consumer).lockWorker
at [/Users/schmar1/go/pkg/mod/github.com/vmihailenco/taskq/v3]()@v3.2.8[/consumer.go:720]()
4 0x0000000004c555d0 in github.com[/vmihailenco/taskq/v3.]()(*Consumer).worker
at [/Users/schmar1/go/pkg/mod/github.com/vmihailenco/taskq/v3]()@v3.2.8[/consumer.go:468]()
5 0x0000000004c53cad in github.com[/vmihailenco/taskq/v3.]()(*Consumer).addWorker.func1
at [/Users/schmar1/go/pkg/mod/github.com/vmihailenco/taskq/v3]()@v3.2.8[/consumer.go:276]()
Oh thank you for the bugreport, I was debugging this today and only then stumbled upon this issue. Removing the limit solves the problem :-)