hackclub/hack-as-a-service-v0

Occasional decimal division by zero when starting in development

Closed this issue · 3 comments

bot_1  | [00] panic: decimal division by 0
bot_1  | [00] 
bot_1  | [00] goroutine 54 [running]:
bot_1  | [00] github.com/shopspring/decimal.Decimal.QuoRem(0x400003e560, 0x0, 0x400009b910, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0)
bot_1  | [00]   /go/pkg/mod/github.com/shopspring/decimal@v0.0.0-20200227202807-02e2044944cc/decimal.go:502 +0x2a4
bot_1  | [00] github.com/shopspring/decimal.Decimal.DivRound(0x400003e560, 0x0, 0x400009b910, 0x0, 0x4000000010, 0x0, 0x7bead3)
bot_1  | [00]   /go/pkg/mod/github.com/shopspring/decimal@v0.0.0-20200227202807-02e2044944cc/decimal.go:544 +0x50
bot_1  | [00] github.com/shopspring/decimal.Decimal.Div(...)
bot_1  | [00]   /go/pkg/mod/github.com/shopspring/decimal@v0.0.0-20200227202807-02e2044944cc/decimal.go:489
bot_1  | [00] github.com/hackclub/hack-as-a-service/pkg/biller.(*Stats).Process(0x40006aa380, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
bot_1  | [00]   /code/pkg/biller/stats.go:45 +0x114
bot_1  | [00] github.com/hackclub/hack-as-a-service/pkg/biller.biller(0x8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x400019f720, 0xe, 0x400019f740, ...)
bot_1  | [00]   /code/pkg/biller/biller.go:173 +0x224
bot_1  | [00] created by github.com/hackclub/hack-as-a-service/pkg/biller.startBillerFromCID
bot_1  | [00]   /code/pkg/biller/biller.go:92 +0x134
bot_1  | [00] exit status 2

I believe this issue isn't specific to my environment, and thus should be fixed lest it happen in production.

This stems from this line; stat.MemoryStats.Limit appears to be zero

Should it return 100% memory usage or 0% memory usage in this case?

Probably 0% usage