-
Notifications
You must be signed in to change notification settings - Fork 126
Closed
Description
MM bot panic (note, I'm running my own fork at https://github.com/norwnd/dcrdex/commits/master - but this is probably relevant for thus upstream repo too):
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x102a4c268]
goroutine 4980 [running]:
decred.org/dcrdex/client/mm.(*unifiedExchangeAdaptor).placeMultiTrade(0x14006ba6600, {0x1400b60a0a0, 0x1, 0x10383541c?}, 0x1)
/Users/norwnd/dcrdex/client/mm/exchange_adaptor.go:970 +0x438
decred.org/dcrdex/client/mm.(*unifiedExchangeAdaptor).multiTrade(0x14006ba6600, {0x1400b60a088, 0x1, 0x1400b608150?}, 0x1, 0x0, 0x6e4f8d3)
/Users/norwnd/dcrdex/client/mm/exchange_adaptor.go:1343 +0xc60
decred.org/dcrdex/client/mm.(*basicMarketMaker).rebalance(0x140087e20c0, 0x6e4f8d3)
/Users/norwnd/dcrdex/client/mm/mm_basic.go:590 +0x274
decred.org/dcrdex/client/mm.(*basicMarketMaker).botLoop.func1()
/Users/norwnd/dcrdex/client/mm/mm_basic.go:634 +0x294
created by decred.org/dcrdex/client/mm.(*basicMarketMaker).botLoop in goroutine 3828
/Users/norwnd/dcrdex/client/mm/mm_basic.go:619 +0x26c
make: *** [a] Error 2
I think MultiTrade
func needs to be adjusted like this:
// MultiTrade is used to place multiple standing limit orders on the same
// side of the same market simultaneously.
func (c *Core) MultiTrade(pw []byte, form *MultiTradeForm) []*MultiTradeResult {
results := make([]*MultiTradeResult, 0, len(form.Placements))
reqs, err := c.prepareMultiTradeRequests(pw, form)
if err != nil {
for range form.Placements {
results = append(results, &MultiTradeResult{Error: err})
}
return results
}
for _, req := range reqs {
var corder *Order
corder, err = c.sendTradeRequest(req)
if err != nil {
results = append(results, &MultiTradeResult{Error: err})
continue
}
results = append(results, &MultiTradeResult{Order: corder})
}
return results
}
there is a related "sanity-check" in MM code after MultiTrade
is called (but it's always gonna pass with master
code version):
if len(placements) != len(results) {
u.log.Errorf("unexpected number of results. expected %d, got %d", len(placements), len(results))
return results
}
not sure if all that ^ means there is a deeper underlying issue, but panic
is certainly not a desired outcome.
Metadata
Metadata
Assignees
Labels
No labels