Hi,
There is a problem with generating Trace IDs that causes having duplicated ones. It's possible to reproduce this problem by running CreateTrace() in parallel at the same time.
The problem is because of the way we generate random numbers. Currently, we found two alternative approaches that we think have much less probability to generate the same random numbers.
Using crypto/rand:
https://golang.org/pkg/crypto/rand/
https://blog.gopheracademy.com/advent-2017/a-tale-of-two-rands/
Using current time and pid as seed:
We can use something like this, as used here in the line 25:
https://golang.org/src/io/ioutil/tempfile.go
Hi,
There is a problem with generating Trace IDs that causes having duplicated ones. It's possible to reproduce this problem by running
CreateTrace()in parallel at the same time.The problem is because of the way we generate random numbers. Currently, we found two alternative approaches that we think have much less probability to generate the same random numbers.
Using
crypto/rand:https://golang.org/pkg/crypto/rand/
https://blog.gopheracademy.com/advent-2017/a-tale-of-two-rands/
Using current time and pid as seed:
We can use something like this, as used here in the line 25:
https://golang.org/src/io/ioutil/tempfile.go