-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: 1.3.0
-
Component/s: JSON & ExtJSON
-
None
Some inputs for decimal128 conversion can take "forever":
{"":{"$numberDecimal":"0E000002000000000000"}}
We should find a way to constrain decimal128 to a computable range rather than rely on full computation and after-the-fact clamping.
Example stack trace of a hung process:
PC=0x4e8d1b m=0 sigcode=0
goroutine 1 [running]:
math/big.nat.mul(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc00001a368, 0x1, 0x1, 0xc00000c160, ...)
/usr/local/go/src/math/big/nat.go:408 +0x1b fp=0xc00009d550 sp=0xc00009d548 pc=0x4e8d1b
math/big.(*Int).Mul(0xc00009d678, 0xc00009d678, 0xc00000c120, 0xc00009d678)
/usr/local/go/src/math/big/int.go:168 +0x119 fp=0xc00009d5c0 sp=0xc00009d550 pc=0x4dedf9
go.mongodb.org/mongo-driver/bson/primitive.ParseDecimal128FromBigInt(0xc00009d678, 0x1d1992ab76e, 0x1, 0xa, 0xc00009d758)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/primitive/decimal.go:337 +0x2e7 fp=0xc00009d6a8 sp=0xc00009d5c0 pc=0x53b107
go.mongodb.org/mongo-driver/bson/primitive.ParseDecimal128(0xc000114000, 0x14, 0x7fc3adc00428, 0x0, 0xc00009d8b0, 0x559fb6)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/primitive/decimal.go:289 +0x55c fp=0xc00009d788 sp=0xc00009d6a8 pc=0x53a96c
go.mongodb.org/mongo-driver/bson/bsonrw.(*extJSONValue).parseDecimal128(0xc000100160, 0x570013, 0xc000100160, 0x0, 0x0)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/bsonrw/extjson_wrappers.go:261 +0x5f fp=0xc00009d7e0 sp=0xc00009d788 pc=0x55beef
go.mongodb.org/mongo-driver/bson/bsonrw.(*extJSONValueReader).ReadDecimal128(0xc000102030, 0x40ba13, 0xc000110000, 0xc00009d8c0, 0x44099e)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/bsonrw/extjson_reader.go:395 +0xad fp=0xc00009d840 sp=0xc00009d7e0 pc=0x55866d
go.mongodb.org/mongo-driver/bson/bsonrw.Copier.CopyValue(0x669c80, 0xc000110000, 0x669d60, 0xc000102030, 0xc000110000, 0x0)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/bsonrw/copier.go:309 +0x95e fp=0xc00009d8c0 sp=0xc00009d840 pc=0x55245e
go.mongodb.org/mongo-driver/bson/bsonrw.Copier.copyDocumentCore(0x664180, 0xc000110000, 0x663840, 0xc000102030, 0x0, 0x604de0)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/bsonrw/copier.go:382 +0xd5 fp=0xc00009d938 sp=0xc00009d8c0 pc=0x5527e5
go.mongodb.org/mongo-driver/bson/bsonrw.Copier.CopyDocument(0x669c80, 0xc000110000, 0x669d60, 0xc000102030, 0x0, 0xc000100000)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/bsonrw/copier.go:45 +0xbf fp=0xc00009d988 sp=0xc00009d938 pc=0x5505ef
go.mongodb.org/mongo-driver/bson/bsonrw.Copier.AppendDocumentBytes(0x7d0138, 0x0, 0x0, 0x669d60, 0xc000102030, 0x0, 0x0, 0x0, 0x0, 0x0)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/bsonrw/copier.go:131 +0x1e7 fp=0xc00009da38 sp=0xc00009d988 pc=0x551047
go.mongodb.org/mongo-driver/bson.PrimitiveCodecs.RawDecodeValue(0xc0000dac40, 0xc00009db00, 0x0, 0x0, 0x669d60, 0xc000102030, 0x606b00, 0xc000100000, 0x197, 0x59bb24, ...)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/primitive_codecs.go:86 +0x136 fp=0xc00009db18 sp=0xc00009da38 pc=0x5afaf6
go.mongodb.org/mongo-driver/bson.PrimitiveCodecs.RawDecodeValue-fm(0xc0000dac40, 0xc000102000, 0x0, 0x0, 0x669d60, 0xc000102030, 0x606b00, 0xc000100000, 0x197, 0x66a200, ...)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/primitive_codecs.go:75 +0x90 fp=0xc00009db80 sp=0xc00009db18 pc=0x5b84d0
go.mongodb.org/mongo-driver/bson/bsoncodec.ValueDecoderFunc.DecodeValue(0xc00001ab30, 0xc0000dac40, 0x606b00, 0x0, 0x0, 0x669d60, 0xc000102030, 0x606b00, 0xc000100000, 0x197, ...)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/bsoncodec/bsoncodec.go:156 +0x98 fp=0xc00009dbe8 sp=0xc00009db80 pc=0x57bea8
go.mongodb.org/mongo-driver/bson.(*Decoder).Decode(0xc000102060, 0x6066a0, 0xc000100000, 0xc00009dd10, 0x663460)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/decoder.go:98 +0x20d fp=0xc00009dcc0 sp=0xc00009dbe8 pc=0x5ae07d
go.mongodb.org/mongo-driver/bson.unmarshalFromReader(0xc0000dac40, 0xc000102000, 0x0, 0x0, 0x669d60, 0xc000102030, 0x6066a0, 0xc000100000, 0x0, 0x0)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/unmarshal.go:100 +0x121 fp=0xc00009dd48 sp=0xc00009dcc0 pc=0x5b3861
go.mongodb.org/mongo-driver/bson.UnmarshalExtJSONWithRegistry(0xc0000dac40, 0xc0000f8090, 0x2e, 0x30, 0x0, 0x6066a0, 0xc000100000, 0x0, 0x5d5980)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/unmarshal.go:72 +0x100 fp=0xc00009dda8 sp=0xc00009dd48 pc=0x5b3700
go.mongodb.org/mongo-driver/bson.UnmarshalExtJSON(...)
/home/xdg/golang/pkg/mod/go.mongodb.org/mongo-driver@v1.3.0/bson/unmarshal.go:60
main.main()
/home/xdg/tmp/godriver-extjson/main.go:25 +0x358 fp=0xc00009df60 sp=0xc00009dda8 pc=0x5b8ec8
runtime.main()
/usr/local/go/src/runtime/proc.go:203 +0x21e fp=0xc00009dfe0 sp=0xc00009df60 pc=0x42ea3e
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc00009dfe8 sp=0xc00009dfe0 pc=0x457171
rax 0xc00009d4b8
rbx 0x0
rcx 0xc000000180
rdx 0xc00009d678
rdi 0x0
rsi 0x0
rbp 0xc00009d5b0
rsp 0xc00009d548
r8 0x0
r9 0x0
r10 0x0
r11 0x1
r12 0x1
r13 0xc00001a368
r14 0x663580
r15 0x0
rip 0x4e8d1b
rflags 0x206
cs 0x33
fs 0x0
gs 0x0
- related to
-
DRIVERS-2651 Add decimal128 clamped zeros tests with very large exponents
-
- Closed
-